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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Check constraint

Re: Check constraint

From: Van Messner <vmessner_at_bestweb.net>
Date: Fri, 13 Oct 2000 22:47:11 GMT
Message-ID: <PhMF5.6417$mC.448649@monger.newsread.com>

Hi Brian:

    Connor answered your question but one of the neat things about SQL*Plus is that you can try stuff quickly. You could create a tiny table and try inserting nulls quicker than you can post to the newsgroup.

Van

"Brian Tkatch" <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK> wrote in message news:39e72ddd.613222609_at_news.alt.net...
> I have a column that must = 1 or 0. SO I want to add a constraint
>
> CHECK (Flag IN (1,2)).
>
>
> 1) Does that exclude NULLs?
>
> 2) Are there any differences, speed or otherwise between
> CHECK (Flag IN (1,2)).
> and CHECK ((Flag = 1) OR (Flag = 2)).
> I'm assuming it would be negligable, but I'm curious.
>
> ============
>
> 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 - 17:47:11 CDT

Original text of this message

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