Several types of
Oracle
constraints can
be applied to
Oracle tables to
enforce data
integrity,
including:
-
Oracle
"Check"
Constraint:
This
constraint
validates
incoming
columns at
row insert
time. For
example,
rather than
having an
application
verify that
all
occurrences
of region
are North,
South, East,
or West, an
Oracle check
constraint
can be added
to the table
definition
to ensure
the validity
of the
region
column.
- Not
Null
Constraint:
This
Oracle
constraint
is used to
specify that
a column may
never
contain a
NULL value.
This is
enforced at
SQL
insert
and
update
time.
-
Primary Key
Constraint:
This Oracle
constraint
is used to
identify the
primary key
for a table.
This
operation
requires
that the
primary
columns are
unique, and
this Oracle
constraint
will create
a unique
index on the
target
primary key.
-
References
Constraint:
This is the
foreign key
constraint
as
implemented
by Oracle. A
references
constraint
is only
applied at
SQL
insert
and
delete
times.
At SQL
delete
time, the
references
Oracle
constraint
can be used
to ensure
that an
employee is
not deleted,
if rows
still exist
in the
DEPENDENT
table.
-
Unique
Constraint:
This Oracle
constraint
is used to
ensure that
all column
values
within a
table never
contain a
duplicate
entry.
Oracle
constraint
views:
|
DBA |
ALL |
USER |
|
dba_cons_columns |
all_cons_columns |
user_cons_columns |
|
dba_constraints |
all_constraints |
user_constraints |
|
dba_indexes |
all_indexes |
user_indexes |
|
dba_ind_partitions |
all_ind_partitions |
user_ind_partitions |
|
dba_ind_subpartitions |
all_ind_subpartitions |
user_ind_subpartitions |
|
|
|