There are three ways to run a trigger: from Database Explorer, from the Eclipse workbench menu bar, and from the context menu in SQL Editor.
To run a trigger from Database Explorer:
From the Tables folder, select the table where the trigger is located and expand it. Open the Triggers folder and select the trigger.
Right-click the trigger and select Run Trigger.
The Modify Attributes and Launch page appears.
Default values fill the Name and Profile fields. The Trigger field in the Type frame is selected. Click the SQL... button and choose insert, update, or delete.
The Insert or Update Column Values dialog appears. In the Column Name field, insert the values that you want the trigger to use by clicking on the column name. Use the buttons to insert a Null value; Select to return the values to be inserted by the insert statement; and Clear to remove any entered insert values. Add arguments as appropriate. If you selected Delete, you see a list of columns in the table; use the various clause tabs to modify the Delete trigger.
Insert column values SQL statements
Statement | Action |
---|---|
insert | All column names appear. In the Column Name field, enter values that you want the trigger to insert. |
update | Choose the columns whose values you want the trigger to update by single-clicking the column name. Enter values in the Column Name field. |
delete | No action at the statement level. Use the Where and Having clause tabs to limit the rows the trigger deletes. |
Use the drop-down lists on the Where and Having tabs to delimit the rows you want the trigger to insert, update, or delete. Manipulate the columns in the Sort and Group clauses to organize the ways in which results are returned. See Using Visual SQL to Edit a Procedural Object to obtain more information about clauses. You can preview the code you have created by selecting the Preview tab. When you are finished, click OK to return to the Modify Attributes and Launch page.
Click Apply to apply the value changes to the launch configuration, then click Run. The code appears in SQL Editor and you can view results in SQL Results.
To run a trigger from the Eclipse Workbench menu bar:
From the Tables folder, select the table where the trigger is located and expand it.
Open the Triggers folder and select the trigger.
Select Run|Run from the Eclipse menu bar. The Create, Manage and Run Configurations page appears, which is the same as the Modify Attributes and Launch page.
Proceed with steps 4 and 5 as above.
To run a trigger from the SQL Editor context menu:
From the Tables folder, select the table where the trigger is located and expand it.
Open the Triggers folder and double-click the trigger name. Its SQL code appears in SQL Editor.
Place the cursor in the code where you want to enter new values into the trigger's SQL code.
Use the context menu to select Visual SQLand choose Insert, Update, or Delete.
The Visual SQL Select Table dialog appears.
Select a table and click Open. The Insert (or Update or Delete) Column Values page appears.
Proceed as in steps 4 and 5 in the first option. You return to SQL Editor.
Using the context menu from inside SQL Editor, select Run . . . to run the trigger.
Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com