我使用Oracle SQL开发人员查询Oracle数据库
所以,我的简化脚本如下:
alter session set current_schema=schema1;
select id from table1
alter session set current_schema=schema2;
select * from table2 where remote_id in (<the list from the 1st query in schema1>)
目前,我手动将列表从一个模式复制到另一个模式。如何自动传递列表?
Oracle中的完全限定数据库对象引用是SCHEMANAME.OBJECTNAME
,因此无论您当前的架构是哪个架构,都可以引用其他架构中的对象,如下所示:
Select *
from schema2.table2
where remote_id in (select id from schema1.table1);