Referencing the foreign key of another schema Referencing the foreign key of another schema oracle oracle

Referencing the foreign key of another schema


To create a foreign key that references an object in a different schema, you just need to qualify the object name

ALTER TABLE B.table_b  ADD CONSTRAINT fk_b_a FOREIGN KEY (apk) REFERENCES a.table_a( apk )

This also requires that the user B has sufficient privileges on A.table_a. The user would need to have the REFERENCES privilege and would, presumably, need to have the SELECT privilege on the table as well.