Connor, thank you for such a detailed answer!
Serge, January 20, 2021 - 3:41 pm UTC
Connor, thank you very much for such a detailed answer!
But you write about the case where two tables are linked by a foreign key. And what about the case when the SQL operator of the triggering statement reads data from another table and there are NOT any foreign keys between these tables? Was the table from which the data was read really "constraining" (according to the old documentation - it also was)?
January 28, 2021 - 9:09 am UTC
No foreign key = no constraining
Thank you, Connor!
Serge, February 04, 2021 - 11:56 am UTC
Thank you, Connor!
Forgive me if I seem overcautious - but will a constraining error occur if you had written "UPDATE emp SET ename = 'AAA', i.e. if you would try to change not the column that is a foreign key to the DEPT table, but the column that does not have any constraints?
February 10, 2021 - 4:56 am UTC
SQL> create or replace trigger bad_trig
2 before update on emp
3 for each row
4 begin
5 insert into dept values (60,'XXX','YYY');
6 end;
7 /
Trigger created.
SQL> update emp set ename = 'XXX' where rownum = 1;
1 row updated.