2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

Basic structure of plsql

What is the basic structure of pl/sql. Any one can explain briefly.
userimage

PL/SQL is a block-structured language, meaning that PL/SQL programs are divided and written in logical blocks of code. Each block consists of three sub-parts:

 

 1                 

Declarations

This section starts with the keyword DECLARE. It is an optional section and defines all variables, cursors, subprograms, and other elements to be used in the program.

2

Executable Commands

This section is enclosed between the keywords BEGIN and END and it is a mandatory section. It consists of the executable PL/SQL statements of the program. It should have at least one executable line of code, which may be just a NULL command to indicate that nothing should be executed.

3

Exception Handling

This section starts with the keyword EXCEPTION. This section is again optional and contains exception(s) that handle errors in the program.

 

Every PL/SQL statement ends with a semicolon (;). PL/SQL blocks can be nested within other PL/SQL blocks using BEGIN and END. Here is the basic structure of a PL/SQL block:

DECLARE

   <declarations section>

BEGIN

   <executable command(s)>

EXCEPTION

   <exception handling>

END;

Answer is