Sql-server – SQL Server 2019 using Linked server to Oracle 19c (19.9) using Oracle 19c client on Windows – DBCOLUMNFLAGS_ISNULLABLE error

linked-serversql-server-2019

Having issues selected data for some Oracle tables over the linked server from SQL Server:

select type, count(*) from RMTDB..JOB1308.HOST_INTERFACE group by type order by 1 desc;

Msg 7356, Level 16, State 1, Line 13
The OLE DB provider "OraOLEDB.Oracle" for linked server "RMTDB" supplied inconsistent metadata for a column. The column "CREATE_TIME" (compile-time ordinal 3) of object ""JOB1308"."HOST_INTERFACE"" was reported to have a "DBCOLUMNFLAGS_ISNULLABLE" of 0 at compile time and 32 at run time.

Open query version of it works:

select * from OPENQUERY( RMTDB, 'select type, count(*) from HOST_INTERFACE group by type order by 1 desc')

result

TYPE      COUNT(*)
10          10450
8            6543
6            21

Anyone run into this?

Best Answer

I found a support.oracle.com Doc ID 1519958.1 that describes the issue.
For solution it says: Use the relatively simple work around of linking to a view that is based upon the table, instead of directly to the table.

Apparently this issue has been around since 2012.