SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)

Adding, Altering, and Dropping SQL/MX Database
Objects
HP NonStop SQL/MX Installation and Management Guide523723-004
9-16
Adding Triggers
For information about explicit and automatic recompilation, see the SQL/MX
Programming Manual for C and COBOL and the SQL/MX Programming Manual for
Java. For information about using DISPLAY USE OF, see Checking Module
Dependencies With DISPLAY USE OF on page 11-20 and the SQL/MX Reference
Manual.
6. Query the system metadata to ensure the new table name is unique among
existing table, view, SQL/MP alias and SPJ names in the schema.
7. Enter the CREATE TABLE statement.
8. Use the GRANT statement to assign access privileges on the new table to
authorized users.
9. Revise the application source code as needed to reflect your changes to the
database. Process and compile the updated source file. For more information, see
the SQL/MX Programming Manual for C and COBOL and the SQL/MX
Programming Manual for Java.
10. Perform a TMF online dump. For a partitioned table, perform an online dump of
each partition.
For more information and examples of adding a table, see Creating SQL/MX Tables on
page 7-11.
Adding Triggers
To add a trigger to an SQL/MX table, use the CREATE TRIGGER statement.
User applications that change (INSERT, UPDATE, or DELETE) information in a table
are automatically recompiled when a trigger with a matching event is added or
dropped. User applications that use a SELECT on the subject table do not require
recompilation. User applications require SQL recompilations only when triggers are
added, altered or dropped. No source code changes or language compilations are
required.
For more information, see the SQL/MX Reference Manual.
Steps for Adding a Trigger
1. Start an MXCI session. Enter a LOG command to initiate a log file for statements
and commands entered in this session. Keep the log for your records.
2. Determine the name of the table to which you want to add the trigger.
3. Query the system metadata to ensure the new trigger name is unique among
existing trigger names defined in the schema.
4. Use the DISPLAY USE OF command to identify which user modules are
associated with this object. See the similarity check criteria in the SQL/MX
Programming Manual for C and COBOL and the SQL/MX Programming Manual for
Java to determine if your changes are likely to cause similarly check to fail and