Question

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.

Was it helpful?

Solution

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);

OTHER TIPS

ALTER TABLE pr_cust
ADD CONSTRAINT deduc_fk
FOREIGN KEY (deducid)
REFERENCES pr_deduc(deducid);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top