Sunday, April 18, 2010

Type of constraints in oracle

Constraint in oracle imposes rule that restrict the values in a oracle database. There are six types of constraint in oracle database and all these constraints except not null constraint can be declared in two ways.

A brief description of these six types of constraints are listed below.

1)Not Null Constraint: If I define a field not null then value must be inserted in to that column.

2)Unique Constraint: If I define a column or set of column to be unique then it prohibits multiple rows from having the same value in the same column or combination of columns but allows some values to be null.

3)Primary Key Constraint: Primary key constraint is the combination of not null constraint and unique constraint. In a single declare it satisfy both constraint.

4)Foreign Key Constraint: Foreign key constraint requires values in one table to match values in another table.

5)Check Constraint: Check constraint imposes restriction of values based on specified condition.

6)REF Constraint: A REF constraint lets you further describe the relationship between the REF column and the object it references.

Constraint related queries: http://askershad.blogspot.com/2010/04/dbaconstraints-userconstraints.html

Thanks.

No comments: