You can create up to 50 different triggers on a table for each command (insert, update, and delete), as well as specify the order in which the triggers are
fired after statement execution by using the order
parameter in the create trigger command. You can create
multiple triggers without an order clause.
The syntax
is:
create [or replace] trigger [owner.]trigger_name
on [owner.]table_name
for {insert | update | delete}
[order integer]
as sql_statements
order integer specifies a partial or full ordering of
trigger firing:
- Full ordering occurs when you create all the triggers using the
order clause.
- Partial ordering occurs if you do not specify the order clause
on some of the triggers. Triggers without the order clause
implicitly take order number 0 and do not have a defined order, except that they
fire after those triggers created using order.
Note: You can only use the order integer clause with
for {insert | update | delete}; you cannot use it with
instead of {insert | update | delete} triggers.
If you use a duplicate number for order, SAP ASE reports an error.
order numbers need not be consecutive; in fact, nonconsecutive
numbers might be preferable, as they allow you to insert new triggers into the middle of
an order.
Use
sp_helptrigger to list:
- All triggers created on the table specified by tablename
- The insert, update, or
delete command that provided the triggering action
- The trigger's order number