Firebird 2.5 Language ReferenceFirebird 2.5 Language ReferenceProcedural SQL (PSQL) Statements → PSQL Blocks
Firebird Firebird Prev: Stored FunctionsFirebird 2.5 Language ReferenceUp: Procedural SQL (PSQL) StatementsNext: Triggers

PSQL Blocks

A self-contained, unnamed (“anonymous”) block of PSQL code can be executed dynamically in DSQL, using the EXECUTE BLOCK syntax. The header of an anonymous PSQL block may optionally contain input and output parameters. The body may contain local variable and cursor declarations; and a block of PSQL statements follows.

An anonymous PSQL block is not defined and stored as an object, unlike stored procedures and triggers. It executes in run-time and cannot reference itself.

Just like stored procedures, anonymous PSQL blocks can be used to process data and to retrieve data from the database.

Syntax (incomplete): 

EXECUTE BLOCK
[(<inparam> = ? [, <inparam> = ? ...])]
[RETURNS (<outparam> [, <outparam> ...])]
AS
[<declarations>]
BEGIN
[<PSQL_statements>]
END
      

Table 7.2. PSQL Block Parameters

Argument Description
inparam Input parameter description
outparam Output parameter description
declarations A section for declaring local variables and named cursors
PSQL statements PSQL and DML statements


Read more:  See EXECUTE BLOCK for details.

Prev: Stored FunctionsFirebird 2.5 Language ReferenceUp: Procedural SQL (PSQL) StatementsNext: Triggers
Firebird 2.5 Language ReferenceFirebird 2.5 Language ReferenceProcedural SQL (PSQL) Statements → PSQL Blocks