oracle - Auditing a table with many columns without Fine Grained Auditing -


i have create trigger table many columns , want if possibility avoid using name of column after :new , :old. instead of use column name want use element collection column names of target table (the table on trigger set).

the line 25 binding error:

dbms_output.put_line('updating customer id'||col_name(i)||to_char(:new.col_name(i))); 

bellow can see trigger:

        create or replace trigger test_trg before       insert or       update on items referencing old old new new each row declare type col_list table of varchar2(60);       col_name col_list := col_list();       total   integer;       counter integer :=0;       begin         select count(*)         total         user_tab_columns         table_name = 'items';         rec in         (select column_name user_tab_columns table_name = 'items'         )         loop           col_name.extend;           counter          :=counter+1;           col_name(counter) := rec.column_name;           dbms_output.put_line(col_name(counter));         end loop;         dbms_output.put_line(to_char(total));         in 1 .. col_name.count         loop         if updating(col_name(i))         dbms_output.put_line('updating customer id'||col_name(i)||to_char(:new.col_name(i)));         end if;         end loop; end; 

sincerely,

i must refine previous answer based on has been said justin cave , findings. can create dynamic list of values triggered inserting , updating, based on referencing clause (old , new). example have created 2 collections of type nested table varchars. 1 collection contain column tabs, strings, use auditing , collection contains values columns binding reference (ex. :new.). after inserting predicate have created index collection (an associative array) of strings id taken list of strings column tab name , value taken list of values columns referenced new. due index collection have full working dynamic list @ disposal. luck :-)


Comments