Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Conditional Constraint?

Re: Conditional Constraint?

From: Paul Ramsteijn <Ramsteijn_at_yahoo.com>
Date: Sun, 22 Dec 2002 11:50:36 +0100
Message-ID: <3E0598FC.DE0128A9@yahoo.com>


Straight from the Oracle 9.1 docs (sql_reference.pdf):

Paul Ramsteijn.

CHECK Constraints
The CHECK clause lets you specify a condition that each row in the table must
satisfy. To satisfy the constraint, each row in the table must make the condition
either TRUE or unknown (due to a null). When Oracle evaluates a CHECK constraint
condition for a particular row, any column names in the condition refer to the
column values in that row.
If you create multiple CHECK constraints for a column, design them carefully so
their purposes do not conflict, and do not assume any particular order of evaluation
of the conditions. Oracle does not verify that CHECK conditions are not mutually
exclusive.
See Also: Chapter 5, "Conditions" for additional information and syntax

wing wrote:

> Hi,
>
> I am new in Oracle and have a query on how to add conditional
> constraint.
>
> Say, I have a simple table Demerit with three fields.
>
> Demerit(DEM_CODE, DEM_DES, POINTS)
> where
> DEM_CODE (N, 2)
> DEM_DES (C, 30)
> POINTS (N, 1)
>
> How to add the following constraint?
>
> All DEM_CODE should carry an integer POINT between 1 to 6 inclusive,
> and DEM_CODE greater than 20 should carry no more than 3 POINT.
>
> Thanks in advance of any ideas and inputs.
>
> Wing


Received on Sun Dec 22 2002 - 04:50:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US