Performs a macro.
where:
Syntax Element … |
Specifies … |
macro_name |
the name of the macro that is to be executed. |
constant_expression |
a constant or an expression involving constants that specifies a parameter value. Values are listed in left‑to‑right order according to the order in which parameter names were specified in the CREATE MACRO request definition. You can specify nulls by typing successive COMMA characters, for example, (a, , b). This is referred to as a positional parameter list. If a value is not supplied for a parameter, a comma must be entered to account for the missing parameter. Any default value defined for that parameter is inserted automatically. |
parameter_name |
a parameter name as defined in the CREATE MACRO request, and supplies the value for that parameter. This is referred to as a named parameter list. The value can be a constant, or an expression involving constants. If a parameter is omitted, any default value defined for that parameter is inserted automatically. |
EXECUTE is a Teradata extension to the ANSI SQL:2011 standard.
You must have EXECUTE privilege on the macro. The creator or any owner of the macro can grant the EXECUTE privilege to another. In addition, the immediate owner of the macro (the database in which the macro resides) must have the necessary privileges on objects named in the request set that are contained in the macro.
For more information, see SQL Data Definition Language and Database Administration.
A data definition request in a macro is not fully resolved until the macro is submitted for execution. Unqualified references to database objects are resolved at that time using the default database of the executing user.
Because of this, object references in data definition statements should always be fully qualified (as databasename.tablename) in the body of the macro.
The following rules apply to performing macros.
EXECUTE macro_1 '(, 1);
EXECUTE macro_1 (,);
EXECUTE macro_1 (NULL, NULL);
Any syntactic or semantic error identified and reported by the SQL parser results in an error being returned to you without logging the request.