Creating triggers for custom tables
If you have created new tables that you want to be staging-enabled, you must add SQL
statements to create and drop triggers for the new table.
Procedure
-
Obtain the required files to add and drop triggers by performing one of the following
actions:
- Review the STAGLOG table information. Use the STAGLOG table information and this topic to create the required triggers for the custom table.
-
Gather the following information about the custom table:
- Table name
- Table scope (site, merchant, or mixed site and merchant)
- Primary or unique key columns
-
Put SQL statements to create three triggers for the custom database table in the
wcs.stage.trigger.sql file. You must create three triggers:
- An INSERT trigger to capture insert operations on the custom table.
- An UPDATE trigger to capture update operation on the custom table.
- A DELETE trigger to capture delete operations on the custom table.
- Ensure that your triggers follow all rules for creating triggers for custom tables.
-
Manually run the wcs.stage.trigger.sql script file to generate the
triggers on the relevant table.
Note: To verify the triggers defined, you run the following SQL statements to query the system table
ALL_TRIGGERS
:select * from all_triggers;
- Put SQL statements to drop the three triggers in the wcs.droptrigger.sql file.