Here is ERD model of my DB:
Here is create table codes i used so far: pastebin
I have created all tables and now I'm trying to alter them to create foreign keys,
but this alter doesn't work.
Alter table uskladnena_surovina add foreign key (datum_spotreby,id_dodavatela,id_suroviny) references ponukana_surovina (datum_spotreby,id_dodavatela,id_suroviny)
/
It says:
"DATUM_SPOTREBY":
00904. 00000 - "%s: invalid identifier"
You need to tell Oracle that you want to create a constraint. To do this, you need to specify add constraint
after alter table ...
. If you don't tell Oracle what you want to add to the table, it assumes you want to add a new column.
Try
Alter table uskladnena_surovina add constraint constraint_name foreign key (datum_spotreby,id_dodavatela,id_suroviny) references ponukana_surovina (datum_spotreby,id_dodavatela,id_suroviny)
/
You also have to give the constraint a name. Feel free to change constraint_name
.
哦对不起伙计们,我忘了将datum_Spotreby添加到uskladnena_surovina,所以显然它无法工作,现在它的工作原理
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.