Products Support Documentation Download

The declare statement is used to declare variables, user-defined conditions, cursors, and exception handlers. SQL requires that variables and conditions be declared before cursors and cursors must be declared before handlers. Declarations must be the first statements that occur after a begin statement.

Cursors define a named select statement for which each row can be retrieved into either explicitly or implicitly declared procedure variables using the fetch statement. An exception handler is used to catch specific or classes of error or status conditions and/or user-defined conditions that are raised using the signal statement. Declarations for each of these objects are described in the following sections.