Question

I am trying to run this on SQL Server 2008 R2.

SELECT * FROM 
OPENQUERY(linked_oracle_server, 'SELECT A.Column1, A.Column2 from A')

This used to work before. We started facing the problem when the A.Column1 was altered to nvarchar2(4000) on the Oracle side.

Now it fails with the following error:

Cannot create a column accessor for OLE DB provider "OraOLEDB.Oracle" for "linked_oracle_server"

I was playing around a bit, if I do SUBSTR(A.Column1,1,2000) it works! And if I change it to SUBSTR(A.Column1,1,2001) it gives the same error as above. Does this have to do with NVARCHAR having a maximum limit of 4000 on the SQL Server side? Is there no way to import an Oracle column of size greater then NVARCHAR2(2000), even though NVARCHAR(MAX) is capable of supporting much bigger data on SQL Server?

Was it helpful?

Solution

The solution to this was to take only half the column length from the oracle side.

If the SQL side column is defined as NVARCHAR(MAX)(MAX being 4000), then the maximum length you can import from the Oracle side is half that. So doing SUBSTR(A.Column1,1,2000) on the Oracle column becomes necessary!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top