Triggers Triggers have a great variety of uses, but in general, - TopicsExpress



          

Triggers Triggers have a great variety of uses, but in general, they permit you to automate tasks that would otherwise have to be done manually. You can use them to define actions that should occur automatically when data is inserted, updated, or deleted in a particular table. Triggers are a versatile tool, with a wide range of uses. The triggers defined in the TUTORIAL database perform the following actions: ● The set_emp_no trigger generates and inserts unique employee numbers when a row is inserted into the Employee table and the set_cust_no trigger does the same for customer numbers in the Customer table. ● The save_salary_change trigger maintains a record of employees’ salary changes. ● The new_order trigger posts an event when a new row is inserted into the Sales table. Using SET TERM In command-line isql and SQL scripts, the trigger statement must be preceded by a SET TERM statement that defines what characters will terminate the trigger statement, since the SQL statements in the body of a trigger must each end with a semicolon (;). The double exclamation mark (!!) is a common choice for this terminator. In environments where the terminator was changed using the SET TERM statement, the trigger code should be followed by another SET TERM statement to change the terminator back to a semicolon. The following example changes the terminator to !!, but ends with the current terminator (semicolon), because that is the one in effect for this statement: SET TERM !!; Changing the Terminator in IBConsole To change the terminator in IBConsole, choose Edit >| Preferences and click on the Interactive SQL tab. Enter a double exclamation mark (!!), or another terminator if you prefer, in the Terminator field. docs.embarcadero/products/interbase/IBXE3Update4/QuickStart/GettingStarted/GettingStarted_Part_V/Triggers.htm
Posted on: Thu, 22 Jan 2015 11:30:53 +0000

Trending Topics



Recently Viewed Topics




© 2015