Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: [student] CHECK statement.
I think you need to add the constraint outside of the column definitions.
You have it as a column constraint. If you add the constraint, giving it a
suitable name, after all the column defs, like you have the other
constraints, you should be OK.
HTH
--
Alan D. Mills
Oliver White wrote in message <362f2cf2.29153546_at_news.m.iinet.net.au>...
>
>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?
>
Received on Thu Oct 22 1998 - 09:47:22 CDT