ITPub博客

首页 > 数据库 > Oracle > Constraint 主键

Constraint 主键

原创 Oracle 作者:roypal 时间:2009-12-31 11:41:04 0 删除 编辑

建立主键时忘记给主键起名字

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博客 ” ,链接:https://blog.itpub.net/21143113/viewspace-1030153/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Orapwd
下一篇: bash&profile
请登录后发表评论 登录
全部评论

注册时间:2009-03-18

  • 博文量
    29
  • 访问量
    32216