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: Check constraint question...

Re: Check constraint question...

From: Svend Jensen <Svend_at_OracleCare.Com>
Date: Thu, 25 Apr 2002 18:43:24 +0200
Message-ID: <3CC8322C.7030407@OracleCare.Com>


CJ Butcher wrote:

> I'm trying to create a check constaraint and get error stating:
>
> ORA-02436: date or system variable wrongly specified in CHECK constraint
>
> Here is my constraint statement:
> ALTER TABLE ACTIVITYTRACKING200205 ADD CONSTRAINT ACTIVITY200205
>
> CHECK (ACTIVITYDATE BETWEEN '01-MAY-02' AND '31-MAY-02');
>
> ACTIVITYDATE is defined as a DATE type. Don't understand why I'm getting
> the error. I'm using Oracle 9i
>
>
> Thanks for any help
>
>
> CJ
>
>
>Hi, Your check string is of type CHAR/VARCHAR2, not comparable with date.

Try ( trunc(activitydate) between to_date(''01-MAY-02','dd-mon-rr')

                           and     to_date('31-MAY-02', 'dd-mon-rr'))

The wise developers include the date format, NLS_DATE_FORMAT can be changed on the server, blowing your sql out of the sky.

/Svend
Svend_at_OracleCare.Com Received on Thu Apr 25 2002 - 11:43:24 CDT

Original text of this message

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