Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the letter codes in Oracle user_contraints table's constraint_type column stand for?

select distinct constraint_type from user_constraints;

C
-
C
P
R
U

Seems P means primary key and R means foreign key, correct? What are U and C?

like image 740
dacracot Avatar asked Oct 08 '08 16:10

dacracot


People also ask

What is constraint type C?

Type of the constraint definition: C - Check constraint on a table. P - Primary key. U - Unique key. R - Referential integrity.

What are user constraints in Oracle?

USER_CONSTRAINTS describes all constraint definitions on tables owned by the current user. Its columns are the same as those in "ALL_CONSTRAINTS". Scripting on this page enhances content navigation, but does not change the content in any way.

What is a check constraint in Oracle?

An Oracle check constraint allows you to enforce domain integrity by limiting the values accepted by one or more columns. To create a check constraint, you define a logical expression that returns true or false. Oracle uses this expression to validate the data that is being inserted or updated.


2 Answers

From the 12cR1 documentation:

C - Check constraint on a table  
P - Primary key  
U - Unique key  
R - Referential integrity  
V - With check option, on a view  
O - With read only, on a view  
H - Hash expression  
F - Constraint that involves a REF column  
S - Supplemental logging
like image 105
user428974 Avatar answered Oct 03 '22 10:10

user428974


Code Description                Acts On Level
---------------------------------------------
C    Check on a table           Column
O    Read Only on a view        Object
P    Primary Key                Object
R    Referential (Foreign Key)  Column
U    Unique Key                 Column
V    Check Option on a view     Object
like image 73
dacracot Avatar answered Oct 03 '22 11:10

dacracot