I want to know whether I can use the OLD and NEW objects for dynamic operations inside trigger.

What I am looking for is something like this :-

1. ABC is a table for which I need to write Trigger.
2. TracK\_Table maintains list of columns for table which need to be tracked (logged).
3. f\_log is a function that inserts changes in data into a tracking(log) table.

```
CREATE OR REPLACE TRIGGER trg_TRACK
AFTER INSERT OR UPDATE OR DELETE ON ABC
FOR EACH ROW
declare
    v_old_val varchar2(1000);
    v_new_val varchar2(1000);
    n_ret int;
    n_id varchar(50);

    cursor cur_col is 
    SELECT  COLUMN_NAME,
        TABLE_name      
    FROM    track_TABLE
    WHERE   upper(TABLE_NAME) = upper('ABC') 
      AND exists (select  cname 
                    from col
                   where UPPER(tname) =upper('ABC') 
                     and upper(cname)=upper(COLUMN_NAME))
      AND upper(allow) = 'Y';

begin
   n_id:= :old.id;

   for i_get_col in c_get_col
   loop
      execute immediate 
         'begin 
            :v_old_val:= select '||i_get_col.column_name ||' 
                           from '||:old ||' 
                          where id = '||n_id ||'; 
          end;' using out v_old_val;
      execute immediate 
           'begin 
             :v_new_val:= select '||i_get_col.column_name ||' 
                            from '||:new ||' 
                            where id = '||n_id ||'; 
            end;' using out v_new_val;
      n_ret := f_log(n_id,i_get_col.column_name,v_old_val,v_new_val);
   end loop;
end;
/

```