A PL/SQL program cab be written in various types of blocks, they are
- Anonymous blocks
- Named blocks
- Nested 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.
Exception handling statements;
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.