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

Home -> Community -> Usenet -> c.d.o.misc -> [student] CHECK statement.

[student] CHECK statement.

From: Oliver White <ojw_at_iinet.net.au>
Date: Thu, 22 Oct 1998 13:12:56 GMT
Message-ID: <362f2cf2.29153546@news.m.iinet.net.au>


I have to create a database for an assignment, could use some help with this problem (yes I've RTFM :) ):

The database contains a table that requires one date field in a tuple to be after another, I have written the code below:

CREATE TABLE FILM_HIRE

   (FILM_NO      NUMBER(4)          NOT NULL,
    CINEMA_CODE  VARCHAR2(5)        NOT NULL,
    HIRE_START   DATE,
    HIRE_END     DATE /* problem here */
        CHECK(HIRE_END>=HIRE_START),

    HIRE_PRICE NUMBER(7),
    PRIMARY KEY(FILM_NO, CINEMA_CODE),
    FOREIGN KEY(FILM_NO) REFERENCES FILM(FILM_NO),
    FOREIGN KEY(CINEMA_CODE) REFERENCES CINEMA(CINEMA_CODE));

But I get this error:

ORA-02438: Column check constraint cannot reference other columns

So how would I rewrite this statement?

Your help graciously accepted, as always :)
--

On the smeeter.
MHM 22x9
--
Received on Thu Oct 22 1998 - 08:12:56 CDT

Original text of this message

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