首页 > 数据库 > Oracle > Constraint 主键
建立主键时忘记给主键起名字
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:来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21143113/viewspace-1030153/ ,如需转载,请注明出处,否则将追究法律责任。