修改oracle中具有约束的字段时,按一般的方式进行修改,通常不起作用,如alter:alter table t_table modify (state char(2) check (state in(0,1,2,-1,3)));,这样的话,不会有效果。
正确的方式是,先drop原有的约束,再alter。
1、查找表上字段的原有约束的名字
select constraint_name from user_cons_columns where table_name = 'T_TABLE' and column_name = 'STATE';
2、drop原有约束
alter table t_name drop constraint SYS_C006828;
3、更新字段约束
alter table t_table modify (state char(2) check (state in(0,1,2,-1,3)));
commit;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9521459/viewspace-707876/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9521459/viewspace-707876/