在sqldeveloper中从不同的oracle连接进行查询
我与 sqldeveloper 中的不同表有 2 个连接。
比方说:
ConnectionA 与表:A、B、C ConnectionB 与表:D、E、F
现在我想要一个如下所示的查询:
select aa.name,dd.id 从 A aa,D dd;
我该怎么做?
I have 2 connections with different tables in sqldeveloper.
let's say:
ConnectionA with tables: A,B,C
ConnectionB with tables: D,E,F
Now I want to have a query that looks like this:
select aa.name,dd.id
from A aa,D dd;
How can i do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果要使用单个 SQL 语句查询两个不同数据库中的对象,则需要在两个数据库之间创建数据库链接。数据库链接是驻留在数据库中且独立于查询工具的对象。例如,在数据库 A 中,您可以创建数据库链接
,然后当您连接到 A 时,您可以执行以下操作
If you want to query objects in two different databases using a single SQL statement, you would need to create a database link between the two databases. A database link is an object that resides in the database and is independent of the query tool. In database A, for example, you could create the database link
And then when you connect to A, you could do something like
显然 TOAD Data Point 支持交叉连接查询,请参阅:
http://dev.toadfordataanalyst.com/webhelp/Content/Query_Builder/Create_CrossConnection_Queries.htm
另外Oracle SQL Developer 似乎支持类似的东西。 (请参阅此博客文章:交叉连接查询)
Apparently TOAD Data Point supports Cross-Connection Queries , see:
http://dev.toadfordataanalyst.com/webhelp/Content/Query_Builder/Create_CrossConnection_Queries.htm
Also Oracle SQL Developer seems to support something similar. (see this blog post: Cross Connection Queries)
我发现这很有帮助,并且针对 Oracle 11g rel 2 及更高版本的 OP 问题:http: //www.dba-oracle.com/t_how_create_database_link.htm 。基本上,右键单击 SQL Developer 中“连接”窗格中的连接,单击“属性”,您将获得主机名、端口和服务名称,您可以将它们插入到 CREATE DATABASE LINK 语句的“USING”部分中。我假设您是否输入服务名称或 SID 取决于您在连接中使用的名称。示例:
创建公共数据库链接
我的链接
连接到
远程用户名
确定为
我的密码
使用 'myserver:1521/MYSID';
I found this helpful and to the point of the OP question for Oracle 11g rel 2 and later: http://www.dba-oracle.com/t_how_create_database_link.htm . Basically, right-click on the connection in the Connections pane in SQL Developer, click Properties, and you get the hostname, port, and service name that you can plug into the "USING" part of the CREATE DATABASE LINK statement. Whether you put in Service Name or SID I assume depends on which you used in your connection. example:
create public database link
mylink
connect to
remote_username
identified by
mypassword
using 'myserver:1521/MYSID';