SQL/MX 3.2.1 Management Manual (H06.26+, J06.15+)
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 Sequence Generators
Use the CREATE SEQUENCE statement to create a sequence generator within a given schema. To
create a sequence generator, you must be the schema owner or the super ID.
A name for the sequence generator must be specified in the CREATE SEQUENCE statement;
however, specifying other attributes such as DATATYPE, LOCATION, START WITH, MAXVALUE,
MINVALUE, INCREMENT BY, CYCLE, ORDER, and CACHE is optional. If optional attributes are
specified, they must be specified only once.
NOTE: ORDER and CACHE attributes are syntactically supported. A warning is displayed if
these attributes are specified in the CREATE SEQUENCE statement.
For more information, see the SQL/MX Reference Manual.
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.
102 Creating an SQL/MX Database










