SQL Language (MOSC)

MOSC Banner

Trigger-based CDC - how to build dynamic CREATE TRIGGER statements from user_tab_cols

edited Jul 25, 2012 6:33AM in SQL Language (MOSC) 6 commentsAnswered ✓
 Here's a head-scratcher:  For all tables in a given schema, I need to duplicate each table (DDL)  for a trigger-based change capture.  For example, DEPT_AUD is created from DEPT using the dbms_metadata function.  Standard WHO columns are appended, and a column holding the DDL type (I, U, D).
I can manually map a row-based trigger on DEPT. When updating or inserting or deleting, the table's OLD columns are inserted into DEPT_AUD with the appropriate key.  If the DEPT table has n number of columns, the CREATE TRIGGER statement will also require n number of inserted columns (plus the WHO, lest we forget).

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center