如何先disable 外键约束再enable它?

zenghongmei1 2002-09-20 01:12:55
imp出错,约束问题,我想先disable掉,imp后再enable。
...全文
282 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zenghongmei1 2002-09-20
  • 打赏
  • 举报
回复
^_^
单个表的
black_snail 2002-09-20
  • 打赏
  • 举报
回复
I guess you want to generate a script to disable all the foreign key

try this

select 'ALTER TABLE '||table_name||' disable constraint '||constraint_name||';' from user_constraints
where constraints_type = 'R'

it will output the script which you can run it to disable the FK in the current shema
zhaoyongzhu 2002-09-20
  • 打赏
  • 举报
回复
ALTER TABLE "SCOTT"."TESTOBJECT"
DISABLE VALIDATE
CONSTRAINT "ZYZ111"

ALTER TABLE "SCOTT"."TESTOBJECT"
ENABLE VALIDATE
CONSTRAINT "ZYZ111"
zenghongmei1 2002-09-20
  • 打赏
  • 举报
回复
是disable所有表,不是一个一个来。

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧