SQL Linked Server Connection to Oracle

rr-4098 2,026 Reputation points
2025-06-04T20:41:16.1066667+00:00

I have a linked server connection between my SQL server and remote Oracle server. I can query the Oracle server from SQL without issue. I need to insert data from SQL into Oracle. The problem is the table names in SQL are different than Oracle. I tried using a select as statement inside the value command and it did not like it.

I was thinking about maybe reading the SQL data into a temp table or variable but wanted to get others thoughts on this.

SQL Server Transact-SQL
SQL Server Transact-SQL
SQL Server: A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.Transact-SQL: A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
197 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 121.3K Reputation points MVP Volunteer Moderator
    2025-06-04T21:10:52.6133333+00:00

    In theory, you should be able to do:

    INSERT ORACLESVR.catalog.schema.tbl(col1, col2, col3)
       SELECT ...
       FROM  localtbl
       WHERE ...
    

    But this often breaks down for various reasons. It's usually easier to run the INSERT statement on the target side, but I don't what Oracle supports in that area.

    I'm not sure what you mean with using a temp table or table variable. I can't see how that could make things easier.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.