문제

I am trying to add a foreign key to my table but i am getting this error,

ERROR at line 3: ORA-00904: "DEDUCID": invalid identifier

ALTER TABLE pr_cust
ADD CONSTRAINT deduc_fk
FOREIGN KEY (deducid)
REFERENCES pr_deduc;

I have this other table named pr_deduc that has a column named deducid, that is a char with one value as my primary key. I have it spelled corrected, unless i am missing something.

도움이 되었습니까?

해결책

The deducid you mention has to be a column on pr_cust, and you are not referencing the column in the other table. The propper syntax is:

ALTER TABLE pr_cust
ADD CONSTRAINT deduc_fk
FOREIGN KEY (deducid)
REFERENCES pr_deduc(deducid);

다른 팁

ALTER TABLE pr_cust
ADD CONSTRAINT deduc_fk
FOREIGN KEY (deducid)
REFERENCES pr_deduc(deducid);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top