I’m working with SSIS 2008 and am having a problem calling an Oracle stored procedure that has an output parameter.
I call the stored procedure in SqlPlus like this:
var vresult number;
exec my_stored_procedure(:vresult);
print vresult;
The statements work and I get the output I need. I am trying to do something similar in SSIS, yet I need to do this repeatedly, maybe in a ForEach or a script to update a temporary result set with the result of calling the stored procedure (the stored procedure generates a number, and I need to add that number to each row in a result set which just holds some state information).
I have tried a lot of different approaches and always end up with ‘invalid statement’ or similar errors.
I have also tried the following approaches:
The crux of the problem seems to be the stored procedure’s output parameter.
I have tried using the the Oracle Provider for OLE DB. Any ideas?
I came up with a solution that works:
So a script that implements this might look something like this:
Paste this script into an Execute SQL task, set the task’s properties and it works!
I’m new to Oracle but it looks like the :1 notation is a place-holder for the variable. You can test this using sqlplus too – just save the code in a file and start sqlplus using the @ option on the command line.
The only problem: I can’t get value of the variable for use in SSIS, but that’s another problem.