Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 8i lite. Problems with Foreign Key on TIME and DATE type columns
Hi Franz,
comments embedded...
"Franz" <fmx77_at_hotmail.com> schrieb im Newsbeitrag
news:9d0Ga.83158$Ny5.2460302_at_twister2.libero.it...
> Is there any problem with foreign key referencing TIME or DATE type
columns?
What is the TIME datatype? Never heard of it.
>
> I'm using oracle 8i lite, for a university project, and I have a problem
> with a single foreign key.
>
> I receive this error message:
>
> OCA-30035: column not found
> [POL-5205] column not found
This error message is to be expected.
Explanation below...
>
> When I try to set the foreign key
>
> ALTER TABLE booking ADD
> (CONSTRAINT fk_booking
> FOREIGN KEY (date, time, room)
> REFERENCES show(date, time, room));
>
>
> between these tables
>
>
> CREATE TABLE booking(
> id_customer VARCHAR(6),
> date DATE,
> time TIME,
> room VARCHAR(20),
> PRIMARY KEY (id_customer, date, time, room)
> );
There is not datatype TIME and you
are using a column name which is a
reserved word (date!). You will
receive errors when trying to create
the table. Therefore you can't create
a foreign key on them.
>
> CREATE TABLE show(
> date DATE,
> time TIME,
> room VARCHAR(20),
> movie VARCHAR(6),
> PRIMARY KEY (date, time, room)
> );
>
> Thanks
>
Or did I get something totally wrong?
Greetings from Germany,
Guido
Received on Fri Jun 13 2003 - 01:22:44 CDT
![]() |
![]() |