gpt4 book ai didi

sql - Oracle 提示 "restrict_all_ref_cons"的含义是什么?

转载 作者:行者123 更新时间:2023-12-03 23:32:21 24 4
gpt4 key购买 nike

我在这样的声明中找到了它:

delete /*+ restrict_all_ref_cons  */ from table_1 where ...

任何人都可以提供一些关于提示正在做什么的信息吗?

该数据库是 Oracle 数据库 10.2.0.3.0。

最佳答案

该提示禁用级联删除,因此从父表中删除时不会从子表中删除子行。

请参阅此处的示例;

http://www.oracle-goldengate.info/archives/ogg-replication-for-delete-parent-table-with-fk-delete-cascade-option.html

create table s11 ( x int primary key );
create table s12 ( y int primary key, x references s11 on delete cascade );
insert into s11 values (1);
insert into s12 values (1, 1);
commit;
SQL> delete from s11;
1 row deleted.
SQL> select * from s12;
no rows selected <=========== when deleting parent row in s11, the child row in s12 is also deleted.

SQL> rollback;
Rollback complete.

SQL> delete /*+ RESTRICT_ALL_REF_CONS */ from s11;
1 row deleted.
SQL> select * from s12; <=========== with RESTRICT_ALL_REF_CONS hint, the child row will not be deleted.
Y X
---------- ----------
1 1

关于sql - Oracle 提示 "restrict_all_ref_cons"的含义是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10997919/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com