Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> [student] CHECK statement.
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),
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