CoderZone.org

Category: >> Oracle PL/SQL >> Constraint Checks Bookmark and Share

<< lastnext >>

Snippet Name: Constraint Checks

Description: A check constraint allows you to specify a condition on each row in a table.

A check constraint can NOT be defined on a VIEW.

The check constraint defined on a table must refer to only columns in that table. It can not refer to columns in other tables.

A check constraint can NOT include a SUBQUERY.

A check constraint can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.

Also see:
» Check Constraint - Create
» Unique Constraint
» Primary Key Constraint
» Foreign Key Constraints
» Current_timestamp
» Deferring Constraint Checking
» Add Primary Key Constraint example
» Add constraint example

Comment: (none)

Author: CoderZone
Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 07th, 2009

clear columns;
clear breaks;
SET linesize 132;
col constraint_name format a20;
col r_constraint_name format a20;
break ON table_name;
 
SELECT cc.table_name, c.constraint_name,
       c.r_constraint_name, cc.column_name
FROM  user_cons_columns cc, user_constraints c
WHERE c.constraint_name = cc.constraint_name AND
      c.constraint_type IN ('P','R')
ORDER BY c.table_name, c.r_constraint_name, cc.position; 
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 19