PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's procedural extension language for SQL and the Oracle relational database. PL/SQL's general syntax resembles that of Ada or Pascal. It is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java.

In general, PL / SQL consists of three parts, namely the declaration, part of writing the commands to be executed and the exception.
  • The Declaration, This section is optional or not absolutely to be written. Because not all PL / SQL variable or constant need to be declared.
  • Writing Commands section, This section is a vital part of a PL / SQL, as if in a PL / SQL are not artifacts of this part of the PL / SQL does not mean anything.
  • The Exception, This part is optional and should not be there in a PL / SQL. The usefulness of this section to indicate when an error occurs in the PL / SQL that you create. If you are sure the PL / SQL that you created is correct, then you do not need to write this section.

Here is an example of the general syntax of writing PL / SQL:

DECLARE

             tipe_data variables; - declare variables

             tipe_data constant constant: = value; - declare a constant

             ...

BEGIN

             statement_1;

             statement_2;

             ...

Exception

             THEN WHEN name_exception

             statement_for_handle_error;

             ...

END;

0 komentar

Related Posts Plugin for WordPress, Blogger...