Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> ON DELETE SET NULL shown as NO ACTION
I find that the delete_rule of ON DELETE SET NULL is shown as NO ACTION in
user_constraints in my database. ON DELETE CASCADE is shown correctly. Real NO
ACTION is shown correctly too (although I hope it's shown differently so I can
tell the difference). Can anyone confirm this to be a bug?
SQL> create table parent (a number primary key);
Table created.
SQL> create table child1 (a number, constraint fk_child1 foreign key (a) references parent on delete cascade);
Table created.
SQL> create table child2 (a number, constraint fk_child2 foreign key (a) references parent on delete set null);
Table created.
SQL> insert into parent values (1);
1 row created.
SQL> insert into parent values (2);
1 row created.
SQL> insert into child1 values (1);
1 row created.
SQL> insert into child2 values (2);
1 row created.
SQL> delete from parent where a = 1;
1 row deleted.
SQL> select * from child1;
no rows selected
SQL> delete from parent where a = 2;
1 row deleted.
SQL> select * from child2;
A
SQL> select count(*) from child2 where a is null;
COUNT(*)
1
SQL> select table_name, delete_rule from user_constraints where table_name in ('CHILD1', 'CHILD2') and constraint_type = 'R';
TABLE_NAME DELETE_RU
------------------------------ ---------
CHILD1 CASCADE CHILD2 NO ACTION
SQL> select * from v$version;
BANNER
Thanks.
Yong Huang
yong321_at_yahoo.com