oracle查詢約束

來源:互聯網
上載者:User

查詢約束類型

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 約束名;

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.