sql server linked server to oracle returns no data found when data exists

后端 未结 5 1940
甜味超标
甜味超标 2020-12-20 15:53

I have a linked server setup in SQL Server to hit an Oracle database. I have a query in SQL Server that joins on the Oracle table using dot notation. I am getting a “No Da

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 16:43

    Today I experienced the same problem with an inner Join. As creating a Table Valued Function suggested by codechurn or using a Temporary Table suggested by user1935511 or changing the Join Types suggested by cymorg are no options for me, I like to share my solution.

    I used Join Hints to drive the query optimizer into the right direction, as the problem seems to rise up from nested loops join strategy with the remote table locally . For me HASH, MERGE and REMOTE join hints worked.

    For you REMOTE will not be an option because it can be used only for inner join operations. So using something like the following should work.

    select *
    from eopf.Batch b
    join eopf.BatchFile bf
      on b.BatchID = bf.BatchID
    left outer merge join [OM_ORACLE]..[OM].[DOCUMENT_UPLOAD] du
      on bf.ReferenceID = du.documentUploadID;
    

提交回复
热议问题