ACTION
DEFINE ACTION
Specifies a named action that is a parameterizable block of multiple top-level expressions.
Syntax
DEFINE ACTION: action definition.- Action name that will be used to access the defined action further in the query.
- The values of parameter names are listed in parentheses.
ASkeyword.- List of top-level expressions.
END DEFINE: The marker of the last expression inside the action.
One or more of the last parameters can be marked with a question mark ? as optional. If they are omitted during the call, they will be assigned the NULL value.
DO
Executes an ACTION with the specified parameters.
Syntax
DO: Executing an action.- The named expression for which the action is defined.
- The values to be used as parameters are listed in parentheses.
EMPTY_ACTION: An action that does nothing.
Example
1. DEFINE ACTION $hello_world($name, $suffix?) AS
2. $name = $name ?? ($suffix ?? "world");
3. SELECT "Hello, " || $name || "!";
4. END DEFINE;
6. DO EMPTY_ACTION();
7. DO $hello_world(NULL);
8. DO $hello_world("John");
9. DO $hello_world(NULL, "Earth");

BEGIN .. END DO
Performing an action without declaring it (anonymous action).
Syntax
BEGIN.- List of top-level expressions.
END DO.
An anonymous action can’t include any parameters.
Example
1. DO BEGIN
2. SELECT 1;
3. SELECT 2 -- here and in the previous example, you might omit ';' before END
4. END DO

