Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: [student] CHECK statement.
do the check in a before insert update trigger
Oliver White wrote in message <362f2cf2.29153546_at_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 - 09:27:29 CDT