Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Check constraint
I have a column that must = 1 or 0. SO I want to add a constraint
CHECK (Flag IN (1,2)).
I have two columns, and for legacy purposes they must work with each other.
If Flag = 1, The_Date must be null
If Flag = 0, The_Date nmust not be null
I've added two constraints to check this
The_Date_NOT_NULL CHECK ( NOT ((Flag = 0) AND (The_Date IS NULL))
The_Date_NULL CHECK ( NOT ((Flag = 1) AND (The_Date IS NOT NULL))
I though an exclusive or would be better, but I could not find such an operator for PL/SQL. Is there one?
Brian Received on Fri Oct 13 2000 - 10:51:44 CDT
![]() |
![]() |