Types of PL/SQL blocks

      A PL/SQL program cab be written in various types of blocks, they are

  1. Anonymous blocks
  2. Named blocks
  3. Nested Blocks

Anonymous blocks:

      Anonymous blocks have no name as a result they cannot be stored in database.They are declared at the point in an application where they are to be executed and passed to PL/SQL engine for execution at run time.

Syntax :

Declaration statements;
Execution statements;
Exception handling statements;


Named blocks:

      Named PL/SQL blocks have names and they have all features as specified for the anonymous blocks. They can be stored in the database and referenced by their name later. Named blocks help in associating with the scope and resolution of variables in different blocks.

They give the specifications of the named spaces as provided in high level OOPs languages like C++ and Java. Named blocks are conveniences for variable management.

Named blocks make the PL/SQL blocks more clear and reliable and also increasing the clarity of programming when we attempt to nesting process and control statements.


Nested Blocks :

      The blocks inside another block are called nested blocks. The outer PL/SQL block is called as parent block or enclosing block and the inner PL/SQL block is known as child block or nested block.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s