What Is an Anonymous Block

Q

What Is an Anonymous Block? - Oracle DBA FAQ - Understanding PL/SQL Language Basics

✍: FYIcenter.com

A

An anonymous block is a PL/SQL code block with no name. It consists of three parts:

  • Declaration Part - Defining local variables and local procedures. Declaration part is optional.
  • Execution Part - Defining execution logic with executable statements. Execution part is required.
  • Exception Part - Defining error handling logics. Exception part is optional.

Here how a complete anonymous block should look like:

DECLARE 
  -- Declaration statements
BEGIN
  -- Executable statements
EXCEPTION
  -- Error handling statements
END;

2007-04-30, 5718👍, 0💬