Create triggers for custom tables
If you have created new tables that you want to be staging-enabled, add SQL statements to create and drop triggers for the new table to the following files:
- (DB2) WC_installdir/schema/db2/wcs.stage.trigger.sql
- (DB2) WC_installdir/schema/db2/wcs.droptrigger.sql
- (Oracle) WC_installdir/schema/oracle/wcs.stage.trigger.sql
- (Oracle) WC_installdir/schema/oracle/wcs.droptrigger.sql
To create triggers for a custom table:
- Review the STAGLOG table information. You will use the STAGLOG table information along with the information on this page 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
Rows in staging-enabled tables rows must be uniquely identifiable by at most five columns: Two columns containing strings (maximum length: 254 characters) and three columns containing numbers (maximum length: BIGINT). If your custom table does not have uniquely identifiable rows within these restrictions, modify your custom database table to meet these criteria.
- 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.
- Put SQL statements to drop the three triggers in the wcs.droptrigger.sql file.
Related Concepts
Staging server
Related tasks
Enabling custom tables for staging
Related Reference
Staging trigger example
Rules for creating triggers for custom tables
Customized database table requirements