如果有外键关联,操作如下
1.禁用约束
alter table youtablename disable constraint contraintname;
参考例子:
select 'alter table '||table_name||' drop constraint '||constraint_name||';' from user_constraints where constraint_type='R'
禁用所有外键约束
Sql代码
select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
启用所有外键约束
Sql代码
select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
2.修改你的id的数据类型,如果不成功,你也可以使用上面的语句禁用主键约束
alter table youname modify id varchar2(20);
3.最后启动主键约束,同时删除外键约束,重新建立起约束关系,参考上面的的语句
1.禁用约束
alter table youtablename disable constraint contraintname;
参考例子:
select 'alter table '||table_name||' drop constraint '||constraint_name||';' from user_constraints where constraint_type='R'
禁用所有外键约束
Sql代码
select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
启用所有外键约束
Sql代码
select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
2.修改你的id的数据类型,如果不成功,你也可以使用上面的语句禁用主键约束
alter table youname modify id varchar2(20);
3.最后启动主键约束,同时删除外键约束,重新建立起约束关系,参考上面的的语句