SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
2-96
CREATE TRIGGER Statement
CREATE TRIGGER Statement
Considerations for CREATE TRIGGER
Examples of CREATE TRIGGER
The CREATE TRIGGER statement is used to create triggers on SQL/MX tables. A
trigger is a mechanism that sets up the database system to perform certain actions
automatically in response to the occurrence of specified events.
Syntax Description of CREATE TRIGGER
trigger-name
specifies the ANSI logical name of the trigger to be added, of the form:
[[catalog-name.]schema-name.]trigger-name
where each part of the name is a valid SQL identifier with a maximum of 128
characters. For information, see Identifiers on page 6-54.
CREATE TRIGGER trigger-name
{BEFORE | AFTER}
{INSERT | DELETE | UPDATE [OF (columns)]}
ON table-name
[REFERENCING old-new-alias-list ]
[FOR EACH {ROW | STATEMENT}]
[ WHEN (search-condition)]
triggered-SQL-statement;
columns is:
column-name, columns | column-name
old-new-alias-list is:
old-new-alias, old-new-alias-list | old-new-alias
old-new-alias is :
OLD [AS] correlation-name |
NEW [AS] correlation-name |
OLD [AS] table-alias
NEW [AS] table-alias
triggered-SQL-statement is:
searched-update-statement |
searched-delete-statement |
insert-statement |
signal-statement |
set-new-statement
signal-statement is:
SIGNAL SQLSTATE quoted-sqlstate (quoted-string-expr);