开发者

Cannot get the data of the row from the OLE DB provider 'ProviderName' for linked server 'LinkedServerName'

开发者 https://www.devze.com 2023-02-06 05:33 出处:网络
I am running into this issue when I try to execute this query involving Linked Server to Oracle. Find the query underneath,

I am running into this issue when I try to execute this query involving Linked Server to Oracle. Find the query underneath,

SELECT DISTINCT Convert(nvarchar(100),A.ZIP_CD)
               ,Convert(nvarchar(100),A.CITY)
               ,Convert(nvarchar(100),A.ST_CD)
               ,Convert(nvarchar(100),E.PCT)
               ,Convert(nvarchar(100),B.DEFAULT_DEL_CHG)
               ,Convert(nvarchar(100),E.DEL_TAX)

FROM [LIVE]..[CUSTOM].MASTER_ZIP A,
     [LIVE]..[MISC].ZONE B,
     [LIVE]..[MISC].ZIP2ZONE C,
     [LIVE]..[MISC].ZIP2TAX D,
     [LIVE]..[SALES].TAT E
WHERE A.ZIP_CD = C.ZIP_CD
AND ISNULL(B.DEFAULT_DEL_CHG,0) <> 0
AND A.USPS_PRIM = 'P'
AND C.ZONE_CD = B.ZONE_CD
AND A.ZIP_CD = D.ZIP_CD
--AND decode(D.TAX_CD,'999','99',d.tax_cd) = E.TAT_CD
AND (Case When D.TAX_CD = 开发者_如何学Python'999' Then '99' Else D.TAX_CD End) = E.TAT_CD

Here is what I get as an error,

Cannot get the data of the row from the OLE DB provider "OraOLEDB.Oracle" for linked server "LIVE".

I found on a forum that said to try to convert to nvarchar as Oracle has problem converting numerics in sql server, but I still get the same error.

Any idea on how to resolve this issue? Thanks.


For what i' ve found until now, there are a few things that could trigger this error.

  • More as 100 results returned. Some people get their queries working when adding "top 100' as a max resultsize.
  • Some claim that you should use openquery() with a fully qualified path to table(inc. server) to perform a query on the linked database.
  • Other say it is the date format being passed which is not compatible.

Go figure which one, I haven' t found the solution yet, but maybe one of these 3 will help you.


Had this problem on view containing join between sqlserver table and view containing openquery on Oracle.

select * 
FROM vwFMC01 
WHERE LOCATIONNAME = '1001002' works ok, but

select * 
FROM vwFMC01 
WHERE LOCATIONNAME = '1001003' fails!

Join is on two varchar(255) fields. Solved the problem converting the joined fields to char(50):

select E.EMPLOYEENUMBER, 
    E.INITIALS, 
    E.NAME1, 
    E.LOCATIONNAME,
    L.DESCRIPTION, 
from biz_tblEmployee E
inner join vwGerpLocation L 
    on convert(char(50), E.LOCATIONNAME) = convert(char(50), L.LOCATIONNAME)


For one thing you need to give column aliases to those columns.

What happens when you do SELECT DISTINCT 'abc' ABC ... ?


We had a similar error .

Cannot get the data of the row from the OLE DB provider "OraOLEDB.Oracle" for linked server "LINKEDSERVER". [SQLSTATE 42000] (Error 7346) OLE DB provider "OraOLEDB.Oracle" for linked server "LINKEDSERVER" returned message "ORA-01403: no data found"

and it turns out that the SQL Server database comparability was changed from 2008 to 2014. This ended up corrupting some indexes. We rolled back the change and retried the queries with no issues.

Since the 2014 compatibility mode was important to us, we changed it to 2014 yet again, rebuilt the indexes and that seemed to eliminate the issues. Hopefully this helps somebody else out there in the w.w.w.


Change

... AND (Case When D.TAX_CD = '999' Then '99' Else D.TAX_CD End) = E.TAT_CD

To

... AND (Case When D.TAX_CD = '999' Then '99' Else D.TAX_CD End) Like E.TAT_CD
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号