Skip to main content
The DO defines a code block that executes syntax.

Required privileges

  • To define a DO block with a , a user must have USAGE privilege on the user-defined type.

Synopsis

do syntax diagram SQL syntax diagram

Parameters

ParameterDescription
routine\_body\_strThe body of the code block.

Examples

Declare a variable in a DO block

The following example uses the to declare variables to use in the code block.

Use a loop in a DO block

The following example uses the to loop through several statements.

Use a common table expression in a DO block

The following example uses a in the body of the code block.

See also