SQL/MX 3.2 Management Manual (H06.25+, J06.14+)

Table Of Contents
This example creates a view from two tables by using an INNER JOIN:
CREATE VIEW MYVIEW4
(v_ordernum, v_partnum) AS
SELECT od.ordernum, p.partnum
FROM SALES.ODETAIL OD INNER JOIN SALES.PARTS P
ON od.partnum = p.partnum;
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, 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 more 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.
Align UCS2 character types on two-byte boundaries.
Align numeric data types as follows:
Align smallint on two-byte boundaries.
Align int on four-byte boundaries.
Align largeint on eight-byte boundaries.
Creating Triggers 101