赞
踩
– 创建
alter table 表名 add constraint 外键名 foreign key(从表外键字段) references foreign_main(主表外键字段);
– 查询外键
select table_name, constraint_name from user_constraints where constraint_type = 'R';
– 禁用外键
select 'alter table SYS_MENU disable constraint FK_SYS_MENU_REFERENCE_SYS_RESO;' from user_constraints where constraint_type = 'R';
alter table SYS_MENU disable constraint FK_SYS_MENU_REFERENCE_SYS_RESO;
– 启用外键
select 'alter table SYS_MENU enable constraint FK_SYS_MENU_REFERENCE_SYS_RESO;' from user_constraints where constraint_type = 'R';
alter table SYS_MENU enable constraint FK_SYS_MENU_REFERENCE_SYS_RESO;
– 删除外键
select 'alter table SYS_MENU drop constraint FK_SYS_MENU_REFERENCE_SYS_RESO;' from user_constraints where constraint_type = 'R';
alter table SYS_MENU drop constraint FK_SYS_MENU_REFERENCE_SYS_RESO;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。