oracle-17-Data dictionary View constraint information

Source: Internet
Author: User

First, view the constraint information

1. Use data dictionary user_constraints to view constraint information for a table in user mode

Sql> Select Owner,constraint_name,constraint_type,table_name

2 from User_constraints;

The above SQL statement can query the constraints of each table in user mode

2. Use the data dictionary user_cons_columns to see which column the constraints are defined for each table

sql> Col column_name fora10;

Sql> col owner for A10;

Sql> Select Owner,constraint_name,table_name,column_name

2 from User_cons_columns;

Actual operation:

STEP1: View the table structure of the user_constriants, such as:


STEP2: View constraint information for a table in the current user mode, note the commands in the figure , such as:



STEP3: The above looks a bit troublesome, then revise, Note the command in the diagram , such as:


For example, a line on the Blue Line, there is a constraint named Ck_age, the type is a check constraint, exists in the D table (the first column owner is the user, the second column constraint_name is the constraint name, the third column C is the constraint type, the fourth column table_name is in which table), For constraint types, the R in the diagram represents a foreign key constraint.

Combat Operations 2 (see which column of the table the constraint is in):

STEP1: View the constraint information for the table in the current user mode, which column can be specific, note the commands in , such as:



STEP2: Find a little messy, then format it, pay attention to command Col column_name for A15; This means that the column_name column length is controlled at 15 characters, such as:



STEP3: Find or mess, continue to format words, such as:



than the blue line, you can see that the current user of the D table has two constraints, respectively, in the D table of sex and age two columns, the constraint names are ck_sex and Ck_age respectively.

oracle-17-Data dictionary View constraint information

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.