How could I make a relationship between two different tables from two different databases in Oracle?
If you have two schemas in the SAME database, S1 and S2, you can do a FOREIGN KEY constraint BETWEEN S1.SonTB and S2.FatherTB with the proper permissions.
If the two schemas are in seperate databases, you have to create database links D1 and D2.
In the two schemas, each points to the other. Then you can create a trigger upon insert and update the S1.SonTB table that implements domain integrity and an upon delete trigger on the S2.FatherTB table that implements the referential integrity constraint.
For More Information
- What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.