Variable, Cursor and Subroutine Declarations
The optional declarations section, located at the start of the body of the function definition, defines variables (including cursors) and subroutines local to the function.Local variable declarations follow the same rules as parameters regarding specification of the data type.See details in the PSQL chapter for DECLARE VARIABLE
, DECLARE CURSOR
, DECLARE FUNCTION
, and DECLARE PROCEDURE
.