Oracle data multi-database joint query

If an SQL statement is involved in the system that needs to be queried across two databases, how should the SQL statement be written? See the following DEMO:

1. First of all, you need to set DataBase links in the main library. The specific setting methods are various on the Internet, and I will not introduce them here
   (it can be implemented through tools such as plsql, or through relevant command lines)
2. Specific SQL statements DEMO:
   select a.account_id, a.account_name, e.facility_id, position
   from account@to_basic a
   left join account_facility_bind e on (a.account_id = e.account_id)
   left join facility@to_basic f on e.facility_id = f.facility_id
   where to_basic is the name of the set DataBase links, the others are the table name and attribute

3. Once executed, it's done!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326864356&siteId=291194637