不知道名字的话,可以查数据字典 select constraint_name,constraint_type from user_constraints where table_name='表名字' and constraint_type='P';
建议你不要这么做,主键的值是不能重复的,你这样更新可能使主键的值重复,就算你删除了或者Disable了主键,如果出现重复的值你就改不回来了. UPDATE aa set id=7 where id=9 这句改不了应该是id=7的记录已经存在了,
取消主键: 得到PK 约束的名称 select constraint_name,constraint_type from user_constraints where table_name='大写的表名字' and constraint_type='P'; 使约束无效: alter table 表名 disable constraint 约束的名称;改完后再update,这一步是能够成功的。恢复约束,同样会失败 alter table 表名 enable constraint 约束的名称;上面提供的是操作步骤,但是正像楼上各位所说的那样, 楼主这样做,为什么呢?
取消主键:alter talbe aa drop primary key; 再加为主键:alter table aa modify(id int primary key);
alter table table drop constraint name;
select constraint_name,constraint_type
from user_constraints
where table_name='表名字' and constraint_type='P';
UPDATE aa set id=7 where id=9 这句改不了应该是id=7的记录已经存在了,
得到PK 约束的名称
select constraint_name,constraint_type
from user_constraints
where table_name='大写的表名字' and constraint_type='P';
使约束无效:
alter table 表名 disable constraint 约束的名称;改完后再update,这一步是能够成功的。恢复约束,同样会失败
alter table 表名 enable constraint 约束的名称;上面提供的是操作步骤,但是正像楼上各位所说的那样,
楼主这样做,为什么呢?
再加为主键:alter table aa modify(id int primary key);