PL SQL Programming Oracle PLSQL Tutorial

An anonymous block does not form the body of a procedure, function, or trigger.
Anonymous blocks can be used inline as part of a SQL*Plus script.
Anonymous blocks can also be nested inside procedure and function blocks for error handling.
The Syntax for PL/SQL Anonymous Blocks

[DECLARE variable_declarations]
BEGIN
  program_code
  [EXCEPTION error_handling_code]
END;
error_handling_code controls branches in the event of an error.
The keyword EXCEPTION begins the portion of the block that contains exception-handling code.
The exception-handling portion of a block is optional.
If the exception-handling portion is present, any runtime error or exception will cause program control to branch to this part of the block.