-
Book Overview & Buying
-
Table Of Contents
IBM DB2 9.7 Advanced Application Developer Cookbook
The ANONYMOUS blocks are standard PL/SQL blocks that provide the ability to build and execute the procedures at runtime, without storing the information in the system catalog. Anonymous blocks do not carry names, and so, can't be referenced by other database objects.
The ANONYMOUS block can contain three sections, which are the declaration section, the execution section, and the exceptional handling section. We can execute these ANONYMOUS blocks from DB2 CLP, DB2 APIs, and various tools, such as Optim database administrator, CLPPlus, and so on.
Interestingly, we do not require any privilege to invoke an anonymous block, but necessary privileges should be available in the base table to invoke the SQL statements.
1. Let's start writing a simple ANONYMOUS block statement. Remember that ANONYMOUS blocks will have no names associated with it.
SET SERVEROUTPUT ON;
BEGIN
NULL;--
END;
This ANONYMOUS block will not return anything...
Change the font size
Change margin width
Change background colour