An anonymous block is a PL/SQL program unit that has no name and it does not require the explicit presence of the BEGIN and END keywords to enclose the executable statements. An anonymous block consists of an optional declarative part, an executable part, and one or more optional exception handlers.
The following short example of a PL/SQL anonymous block prints the names of all employees in department 20 in the Emp_tab table, using the DBMS_OUTPUT package:
Cursor c1 IS SELECT Ename FROM Emp_tab
WHERE Deptno = 20;
FETCH c1 INTO Emp_name;
EXIT WHEN c1%NOTFOUND;