I am trying to use NDS or dynamic SQL in an update trigger to extract the value of the :new and the value of :old for a given column.
Consider the following example. I have a table T with these 20 fields:
x1 varchar2(32) x2 number (16) x3 date ......
The column names are in a dynamic array called colnameList. When the trigger fires, for each record, I want to call a stored procedure with column name, value of the old and new for the column :new.X1, :old.X1:
Procedure (colnameList(i),:new.||'colnameList(i),:old.||colnameList(i))I tried to extract the value like this:
execute immediate 'select '||':new'||'.'||colmnames(i)||' from dual' into tmpVarn;but it won't work.
execute immediate 'begin select '':new.'||colmnames(i)||''' into :out from dual; end;' using out tmpVarn;Make sure you leave in "begin" and "end," else you will receive an invalid character error.