Configuring table-level user exits
A table-level user exit lets you define a set of actions that CDC Replication can run before or after a database event occurs on a specified table.
When using CDC Replication, a database event is defined as either a row-level operation or as a table-level operation. Row-level operations include an insert, update, or a delete. Table-level operations include a refresh or a truncate operation. For example, you can configure a row-level user exit program that sends an alert after CDC Replication replicates a delete operation on a particular target table.
User exits can be grouped as either a Before User Exit or an After User Exit:
- Before User Exit
- Runs before CDC Replication replicates any row-level or table-level operations to the target table.
- After User Exit
- Runs after CDC Replication replicates any row-level or table-level operations to the target table.
The following list identifies common scenarios for developing a user exit program before or after row or table-level operations:
- Customize when CDC Replication replicates a row-level operation to the target table. For example, you can develop logic for insert, update, or delete operations so that these occur based on some specified criteria, such as the original invoice date. CDC Replication can run the user exit and apply the row-level operation (insert, update, or delete) to the appropriate target table based on the original invoice date, such as, January 2004, February 2004, November 2006, and so on.
- Disable the default row-level or table-level operations, and replace them by invoking a user exit program that performs custom operations. For example, in response to a table-level truncate operation, you can develop a user exit that lets you do a soft delete rather than a hard delete on the target table.
A consideration to keep in mind is that many databases have column name length limitations, which can affect how some expressions, user exits, and derived columns are handled. Column name length limitations can cause CDC Replication to describe a column alias to the target when the source column name length exceeds the column name length limit on the target. The restriction is 30 characters for most CDC Replication compatible databases (IBM® DB2® for Linux, UNIX, and Windows and Oracle). Microsoft SQL Server has a limit of 128 characters.