I have two tables, that has references with ID of products. Tables are like below.
Table 1 : ID, Rgrupa Table 2: ID, Rgrupa
I would like to create trigger, that will update Rgrupa from table 2, when Rgrupa is updated in table 1, for the same ID of product.
I have tried this
create or replace trigger test
after update of rgrupa on table1
begin
update table2 t2
set t2.rgrupa = :new.rgrupa
where t2.id = :new.id;
end;
And ERROR MESSAGE is: Error: ORA-04082: NEW or OLD references not allowed in table level triggers
I used below structure to create the trigger
If I run your code:
Oracle clearly says that you have an issue in your code. If you want to use the
:new
, you need a row-level trigger: