BLOCK STATEMENT
Description
PL/pgSQL is a block-structured language. The complete body of a procedure is defined in a block, which contains variable declarations and PL/pgSQL statements. A statement can also be a nested block, or subblock.
Grammar Syntax
[ <<label>> ]
[ DECLARE
declarations ]
BEGIN
statements
EXCEPTION
WHEN OTHERS THEN
statements
END [ label ];
Sample Source Patterns
Input Code:
CREATE OR REPLACE PROCEDURE MY_PROCEDURE()
AS
$$
BEGIN
NULL;
END;
$$
LANGUAGE plpgsql;
Output Code:
CREATE OR REPLACE PROCEDURE MY_PROCEDURE ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "redshift", "convertedOn": "02/10/2025", "domain": "test" }}'
AS
$$
BEGIN
NULL;
END;
$$;
Known Issues
There are no known issues.
Related EWIs.
There are no related EWIs.
Last updated