Error de SQL: ORA-00904: identificador no válido (clave externa)

Can't find the mistake in:

ALTER TABLE REZERVACIJA
ADD CONSTRAINT REZERVACIJA_KAMBARYS_FK1 FOREIGN KEY(KAMBARIO_NUMERIS)
REFERENCES KAMBARYS(KAMBARIO_NUMERIS)
ON DELETE CASCADE;

preguntado el 27 de noviembre de 13 a las 08:11

What have you done to try to find the mistake? Just so that the obvious can be ruled out ... -

I search for solution in books, internet..but i cant find the answer -

How does your table KAMBARYS ¿parece? Es KAMBARIO_NUMERIS it's primary key? -

Please post your definitions of the tables KAMBARYS y REZERVACIJA. I would guess the error is somewhere in there. -

It doesn't look like KAMBARIO_NUMERIS is a column in REZERVACIJA table, but you are trying to use it as a foreign key. -

1 Respuestas

According to the DDL in your comments, shouldn't it be:

ALTER TABLE REZERVACIJA
ADD CONSTRAINT REZERVACIJA_KAMBARYS_FK1 FOREIGN KEY (REZERVACIJOS_KODAS)
REFERENCES KAMBARYS(KAMBARIO_NUMERIS)
ON DELETE CASCADE;

respondido 27 nov., 13:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.