SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)
Creating an SQL/MX Database
HP NonStop SQL/MX Installation and Management Guide—523723-004
7-39
Creating Triggers
Creating Triggers
Use the CREATE TRIGGER statement to create triggers on SQL/MX tables. A trigger
is a mechanism that sets up the database to perform certain actions automatically in
response to the occurrence of specified events. To create a trigger, you must own its
schema or be the super ID user. You must also own the schema where the subject
table resides and have appropriate privileges on the referenced table.
For more information about triggers and the CREATE TRIGGER statement, see the
SQL/MX Reference Manual.
Guidelines on Using Triggers
•
Do not use triggers on SQL/MX user metadata tables, system metadata tables, or
MXCS metadata tables.
•
You cannot define triggers on SQL/MP objects. SQL/MP objects cannot be
referenced in a trigger.
Trigger Temporary Tables
When you create the first trigger on a table, NonStop SQL/MX automatically creates
one trigger temporary table for all triggers on that table. The trigger temporary table
stores results that are generated while one of the base table’s triggers is activated.
NonStop SQL/MX drops the trigger temporary table when the last trigger defined on
that table is dropped.
Creating Stored Procedures in Java
Use the CREATE PROCEDURE statement to register an existing Java method as an
SPJ within an SQL/MX database. For information, see the SQL/MX Guide to Stored
Procedures in Java.
Database Design Guidelines for Improving
OLTP Performance
To improve database performance in an online transaction processing (OLTP)
environment, observe these guidelines when you design an SQL/MX database:
•
Make columns NOT NULL NOT DROPPABLE unless null values are needed. Null
processing imposes disk space and performance overhead that should be avoided
whenever possible.
•
Align fields on appropriate boundaries:
°
Align character data types as follows:
°
Align ASCII character types on one-byte boundaries.