DO
Function
DO executes an anonymous code block.
The code block is treated as though it were the body of a function with no parameters, returning void. It is parsed and executed a single time.
Alternatively, it executes an expression but does not return any result.
Precautions
Compared with the original openGauss, Dolphin modifies the DO syntax as follows:
The DO expr_list syntax is added based on the original syntax to execute expressions without returning results.
Syntax
DO [ LANGUAGE lang_name ] code;
Or
DO expr[,expr...];
Parameter Description
- lang_name - Specifies the name of the procedural language the code is written in. If omitted, the default is plpgsql. 
- code - Specifies the procedural language code to be executed. This must be specified as a string literal. 
- expr - Specifies expressions. Multiple expressions are separated by commas (,). For details, see Expressions. 
Examples
--Execute an expression without returning results.
openGauss=# DO 1;
openGauss=# DO pg_sleep(1);
--Execute multiple expressions without returning results.
openGauss=# DO 1+2;