A trigger is a database object. When you create a trigger, you specify the table and the data modification commands that should “fire” or activate the trigger. Then, you specify any actions the trigger is to take.
For example, this trigger prints a message every time anyone tries to insert, delete, or update data in the titles table:
create trigger t1 on titles for insert, update, delete as print "Now modify the titleauthor table the same way."
Except for the trigger named deltitle, the triggers discussed in this chapter are not included in the pubs2 database shipped with Adaptive Server. To work with the examples shown in this chapter, create each trigger example by typing in the create trigger statement. Each new trigger for the same operation—insert, update or delete—on a table or column overwrites the previous one without warning, and old triggers are dropped automatically.