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 -> Simple Check Constraint Condition Question...

Simple Check Constraint Condition Question...

From: Stephen Hurrell <hurrells_at_baynet.net>
Date: Fri, 10 Sep 1999 01:59:12 -0400
Message-ID: <37D89E30.68FEFD09@baynet.net>


Hello.

I have a simple table example;

create table events (

                event_year    varchar2(4) not NULL,
                event_date    date not NULL
)

What I want is to constrain event_year to be equal to the year portion of event_date. Event_year is entered as a YYYY value.

I think that this is close to what I want in the constraint.

event_year = to_date(event_date, 'YYYY')

However I get a ORA-2436: date or system variable wrongly specified in CHECK constraint.

Does this mean that I should be translating the date to a string?

STeve
-----EOT Received on Fri Sep 10 1999 - 00:59:12 CDT

Original text of this message

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