建立主键时忘记给主键起名字
alter table test add primary key(id)
--建立有名称的主键
alter table test add constraint pk_id primary key(id)
而后想删除主键,
alter table test drop constraint PK_name
却不知道主键名称。
查询表中的主键
select * from user_constraints where table_name='test'
其中Contraints_type列内容解析如下...
[@more@] sDBA_constraints.CONSTRAINT_TYPE/User_Constraints:C: Check ,On Table
O: Read Only, On View
P: Primary Key
R: FK(Foreign Key, Referential Integrity)
U: Unique Key
V: Check Option, On View
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21143113/viewspace-1030153/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21143113/viewspace-1030153/