Inside the trigger, I try to iterate over all the columns of the table and compare the new values with the old values. Here is what I still have:
CREATE OR REPLACE TRIGGER "JOSH".TEST
UPDATE ON "JOSH"."TEST_TRIGGER_TABLE" REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
declare
oldval varchar(2000);
newval varchar(2000);
begin
for row in (SELECT column_name from user_tab_columns where table_name='TEST_TRIGGER_TABLE') loop
execute immediate 'select :old.'||row.column_name||' from dual' into oldval;
execute immediate 'select :new.'||row.column_name||' from dual' into newval;
end loop;
end;
The trigger compiles, but when the trigger fires, I get:
ORA-01008: not all variables are related
on first execution immediately, because it expects a value for :old. :oldand :newalready defined as part of the trigger, but it seems that the immediate start of these variables cannot be specified.
Is there a way to dynamically iterate over column values in a trigger?
source
share