oracle 查询约束

oracle

查询约束类型

select distinct constraint_type fromdba_constraints;

Type Code

Type Description

Acts On Level

C

Check on a table

Column

O

Read Only on a view

Object

P

Primary Key

Object

R

Referential AKA Foreign Key

Column

U

Unique Key

Column

V

Check Option on a view

Object




查询各种约束

user_constraints            all_constraints           dba_constraints

select * from user_constraints where constraint_type='R'

select * fromALL_constraints where constraint_type='P'

select * from dba_constraintswhere constraint_type='C'

我们关心的视图以下列前缀命名:
  ·USER_  :当前用户模式下创建的对象
  ·ALL_  :当前用户模式下创建的对象加上当前用户能访问的其他用户创建的对象。ALL视图常常包含一个"OWNER"列,反映出能够访问的对象的所有者。在USER_TABLES表中不能看到OWNER列是因为你就是在这个视图中所有表的所有者;在ALL_TABLES中有一个OWNER字段。
  ·DBA_   :它提供了整个数据库的信息。包括数据库中所有表的名字和拥有者——包括SYS模式下的基本表
这些前缀在限制我们想看到的、需要看到的、应当被允许看到的范围上是一个帮助。查看当前模式下创建的表,查询USER_TABLES;

修改约束

alter table 表名 enable/disable/dropconstraint 约束名;

  • 发表于 2017-11-13 16:56
  • 阅读 ( 1422 )
  • 分类:默认分类

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
不写代码的码农
- Nightmare

33 篇文章

作家榜 »

  1. 威猛的小站长 124 文章
  2. Jonny 65 文章
  3. 江南烟雨 36 文章
  4. - Nightmare 33 文章
  5. doublechina 31 文章
  6. HJ社区-肖峰 29 文章
  7. 伪摄影 22 文章
  8. Alan 14 文章