

Syntaxįollowing is the syntax of EXECUTE MACRO statement. You need EXEC privilege to execute the Macros. Within a Macro, these parameters are referenced with (semicolon).įollowing is an example of a Macro that accepts parameters.ĬREATE MACRO Get_Emp_Salary(EmployeeNo INTEGER) AS ( The following example executes the Macro names Get_Emp When the following command is executed, it retrieves all records from employee table. Syntaxįollowing is the syntax of EXECUTE MACRO command. It contains a select statement to retrieve records from employee table.


The following example creates a Macro called Get_Emp. Syntaxįollowing is the generic syntax of CREATE MACRO command.ĬREATE MACRO (Ĭonsider the following Employee table. Macros are created using CREATE MACRO statement. Macros can contain DDL statements, but that should be the last statement in Macro. If one of the SQL statements in Macro fails, then all the statements are rolled back. Macro statements are executed as a single transaction. Users don't need separate privileges on the database objects used inside the Macro. Users only need EXEC privilege to execute the Macro. The definition of Macros is stored in Data Dictionary. Macro is a set of SQL statements which are stored and executed by calling the Macro name.
