0

We are migrating from SQL Server 2005 to Oracle 11G. I have been trying to do an update to a table in Oracle using data stored in a table in SQL Server.

Using SQL Developer, I have completed the following:

  1. Created a connection to the Oracle Database

    Created Connection name --> e9_crp
    Supplied User name and Pass
    Defined Host Name and SID
    
  2. I also created a connection to the SQL Server that contains the reference data

    Connection Name --> sql_data
    User Name and Pass
    Host and Port
    

The connection name used for SQL Server is sql_data

The connection name used for Oracle is e9_crp

The table in SQL Server is in a database my_tmp with owner of dbo and is called tiers (my_tmp.dbo.tiers).

In SQL Developer, I can see, select, and view the tiers table. This SQL statement also works using the worksheet when in the sql_data connection:

 select * from [my_tmp].[dbo].[tiers]

Trying to connect to this table when in the e9_crp connection schema, I have been trying to do something like this:

 select * from [sql_data].[my_tmp].[dbo].[tiers]

But this returns an error stating that the tiers table does not exist:

 ORA-00903: invalid table name
 00903. 00000 -  "invalid table name"

Both tables have a unique ID of 'item', so in a perfect world this should work:

 select a.itm, b.tier
 from [e9_crp].[crpdta].[itemmaster] a inner join [sql_data].[my_tmp].[dbo].[tiers] b
     on(a.itm = b.itm)

This is assuming that I use the connection name in the table identifier. BUT, this obviously does not work. What I need to do is be able to join these 2 databases together in a similar fashion as necessary.

How can I use SQL Developer to join these 2 tables? I have tried multiple iterations of table strings for the join but no luck. Any help is appreciated.

1 Answer 1

1

Oracle has the concept of a DBLink, and SQL Server has the concept of a Linked Server. Both these features let you query data from two separate databases.

Here's a link with instructions for setting up an Oracle DBLink to a SQL Server DB...

http://www.dba-oracle.com/t_database_link_sql_server_oracle.htm

And here's a link with instructions for setting up a SQL Server Linked Server to an Oracle DB...

http://support.microsoft.com/kb/280106

See also this SO post...

SQL statement joining Oracle and MS SQL Server

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.