0

I'm trying to pass the following SQL query as a linked server stored procedure, but I get an error, please advise, thanks in advance!

Msg 7215, Level 17, State 1, Line 17
Could not execute statement on remote server 'CAFUAT'.

Explanations:

  • CAFUAT = Oracle Linked server
  • CDBWEB = User
  • STP_CAF_PERSON = stored procedure

Code:

DECLARE @AVEMAIL VARCHAR(255) 
DECLARE @ANCDPXID NUMERIC
DECLARE @AVCDPURN VARCHAR(12) 

SELECT @AVEMAIL  = '[email protected]' 
SELECT @ANCDPXID  = null 
SELECT @AVCDPURN  = null 

EXECUTE ('BEGIN CAFUAT.CDBWEB.STP_CAF_PERSON(?,?,?,?); END;', @AVEMAIL,@ANCDPXID,@AVCDPURN) AT CAFUAT

DECLARE @PrintVariable VARCHAR (4000)

SELECT @PrintVariable =  'ANCDPXID ='  +  CONVERT(VARCHAR(23), @ANCDPXID) 
PRINT @PrintVariable

SELECT @PrintVariable =  'AVCDPURN ='  +  ISNULL(CAST(@AVCDPURN AS VARCHAR(8000)), '' ) 
PRINT @PrintVariable
7
  • Ha. That unformatted GO at the end of your post makes it sound like you're ordering us to get to work :) Commented Aug 18, 2015 at 14:47
  • Just a thought, you've got four question marks in your statement, but only 3 parameters listed afterwards; are you missing a parameter? Also, is "CDBWEB" the schema user or a package name? Commented Aug 18, 2015 at 14:56
  • Hi Boneist, you are correct, i have removed the extra question mark. CDBWEB is the user which has privileges to execute the SP on the linked ORACLE server. Commented Aug 18, 2015 at 15:01
  • However, its still showing the same error message: Commented Aug 18, 2015 at 15:31
  • AVCDPURN = Msg 7215, Level 17, State 1, Line 16 Could not execute statement on remote server 'CAFUAT'. Commented Aug 18, 2015 at 15:34

1 Answer 1

1

just to update, below is the working query, plus i resintalled the 32-bit Oracle driver;

EXECUTE('Call STP_CAF_PERSON(?,?,?)', @AVEMAIL OUTPUT, @ANCDPXID OUTPUT, @AVCDPURN OUTPUT) AT [CAFUAT]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.