DO statement defines a code block that executes PL/pgSQL syntax.
Required privileges
- To define a
DOblock with a user-defined type, a user must haveUSAGEprivilege on the user-defined type.
Synopsis
Parameters
Examples
Declare a variable in a DO block
The following example uses the PL/pgSQL DECLARE syntax to declare variables to use in the code block.
Use a loop in a DO block
The following example uses the PL/pgSQL WHILE syntax to loop through several statements.

