7.4 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 variables, cursor declarations and local routines, followed by a block of PSQL statements.

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)

  [(<inparam> = ? [, <inparam> = ? ...])]
  [RETURNS (<outparam> [, <outparam> ...])]
<psql-module-body> ::=
  !! See Syntax of Module Body !!

Table 7.4.1 PSQL Block Parameters


Input parameter description


Output parameter description


A section for declaring local variables and named cursors

PSQL statements

PSQL and DML statements

See alsoSee EXECUTE BLOCK for details.