Structure of pl-sql program


Prev Tutorial Next Tutorial

Structure of pl-sql program

pl-sql program is very easy to write and execute, Here i will show you in very simple way. pl-sql program contains mainly four section, they are given below;

  • Declare section
  • Begin section
  • Exception section
  • End section

Syntax

declare				-------- 1
declaration variable;
begin				-------- 2
statement-1;
....................
statement-n;
exception			-------- 3
exception handling statements
end;				-------- 4
  • Declare section: In this section user declare all the variables, cursor declaration etc.
  • Begin section: In this section, you need to declare all the executable statements, logical statements etc.
  • Exception section: In this section you need to write all the exception handling statements, which is used to convert system defined error message into user friendly error message.
  • End section: In this section represent end of the pl-sql program or block.

Example

begin
dbms_output.put_line("Hello word");
end;

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements