I have verified that I am able to use OPENQUERY to query tables in the linked server, even the table being queried from within the oracle stored procedure. I have already executed the oracle stored procedure from the oracle command line utility and it works properly.
I have tried so many variations of the openquery and changes to the oracle procedure that i'm out of options. Here is the error message i receive when running the openquery (see code snippet's).
(note: i have tried it using the MS Oledb Driver for Oracle and the Oracle provided drivers, same result, though a slightly different message - both still indicate the "no columns" issue)
OLE DB error trace [Non-interface error: OLE DB provider unable to process object, since the object has no columnsProviderName='OraOL
Msg 7357, Level 16, State 2, Line 1
Could not process object 'GET_AGE_OF_FIRST_OFFENSE'
. The OLE DB provider 'OraOLEDB.Oracle' indicates that the object has no columns.
To give the bigger picture, a third party vendor (with an oracle database) has some data for our application to consume. Our application is limited to only using OPENQUERY to get that data and insert it into our database for later processing. For 99% of the data the vendor has provided views that we can query without any issues using OPENQUERY - however, they have one stored procedure that returns a ref cursor and we need to receive it via OPENQUERY and subsequently insert it into one of our local tables (its more complicated than that, but suffice to say, we are stuck with openquery and stuck with the remote data coming from a stored procedure).
If all were working well we would do something like this
INSERT INTO OUR_LOCAL_TABLE
where @SQL contains the openquery dynamic SQL - again, this works wonderfully when the remote data is in a view, but we get the above error when the remote data is in a stored procedure.
Oracle code example:
create or replace PROCEDURE GET_AGE_OF_FIRST_OFFENSE
( t_cursor OUT SYS_REFCURSOR )
OPEN t_cursor FOR
select * from age_of_first_offense;
select * from openquery(ORACLE_TEST,'GET_AGE_OF_FIRST_OFFENSE')