Home Oracle Commands Oracle Syntax PL /SQL
PL SQL Books
Structure of PL/SQL Statements

All PL/SQL functions and procedures, including packaged procedures and anonymous blocks follow the following basic layout:

Structure:

   [PROCEDURE name
   IS]

or

   [FUNCTION name RETURN datatype
   IS]

 DECLARE
 /* declarations */
   
 BEGIN
 /* executable code */

 [RETURN value]       <-- for functions

 EXCEPTION
 /* error handling */

 END;

Or a flat file SQL script can contain simply:

   BEGIN
   /* executable code */

   EXCEPTION
   /* error handling */

   END;

This is known as an 'anonymous block'



Related Commands:


Related Views:

 




Back to the Top

Simon Sheppard
SS64.com