Oracle query Constraints

Source: Internet
Author: User

Query constraint type

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

 

 

 

 

 

 




Query various constraints

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'

The following table lists the prefix names of a view:
· User _: the object created in current user mode
· All _: Objects Created in current user mode plus objects created by other users that can be accessed by the current user. The all view usually contains a "owner" column, reflecting the owner of the objects that can be accessed. The owner Column cannot be seen in the user_tables table because you are the owner of all tables in this view. There is a owner field in all_tables.
· DBA _: it provides information about the entire database. Including names and owners of all tables in the database-including basic tables in SYS Mode
These prefixes are helpful in limiting what we want to see, what we need to see, and what we should be allowed to see. View the table created in current mode and query user_tables;

 

Modify Constraints

Alter table table name: enable/disable/dropconstraint constraint name;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.