Hi All,
I am following this article
https://support.microsoft.com/en-us/kb/314520
1. Using "Pass Basic Value" I can fetch successfully required data from Oracle. This is what I executed
declare @MySql varchar(500), @CustID varchar(10) = 102060 set @MySql = 'select * from OPENQUERY (OracleDEVL, ''select * from customers where customer_id = ''''' + @CustID + ''''''')' execute (@MySql)
2. Using "Use the Sp_executesql Store Procedure" I am getting below error no matter what I do
<<
OLE DB provider "OraOLEDB.Oracle" for linked server "OracleDevl" returned message "Unspecified error".Msg 7323, Level 16, State 2, Line 38
An error occurred while submitting the query text to OLE DB provider "OraOLEDB.Oracle" for linked server "OracleDevl".
>>
Here is how I am trying to execute this
DECLARE @CutomerID varchar(10) = 102060 EXECUTE OracleDevl.master.dbo.sp_executesql N'select * from Customers where customer_id = @CustID', N'@CustID varchar(10)', @CutomerID
I cannot make is work using 2nd (sp_executesql) method. This method looks more cleaner but I cannot make it execute successfully. Please tell where is mistake.
Thanks in advance for your time.
snaseer - Houston