Executing Store Procedures in DB2 UDB

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
bnagel
Participant
Posts: 3
Joined: Thu Apr 10, 2003 4:53 pm
Location: USA

Executing Store Procedures in DB2 UDB

Post by bnagel »

I have some stored procedures with input parameters that I need to execute in Data Stage. How can this be done?

Brian G Nagel
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well... the only stage (other than BCPLoad, that is) that directly supports Stored Procedures is the ODBC stage. Choose the Update Action of "Call stored procedure" and then all of your columns become input parameters.

-craig
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Provided you get the syntax correct, curly braces and all, you should be able to use CALL via user-defined SQL in pretty much any stage type that supports SQL (for example the DB2 stage).

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
bigpoppa
Participant
Posts: 190
Joined: Fri Feb 28, 2003 11:39 am

Post by bigpoppa »

Has anyone been able to successfully call a stored proc from within the DB2 stage?

My java stored procedure is a simple count(*) on a table. My call, which works find from the db2 commandline, has been:

Call Get_Count(?)

I've tried several variations on this call in the 'Before' routine and in the 'user generated sql' sections of the DB2 stage, but I don't think my call syntax is correct. No matter what, I get the same error:

"07001 The number of host variables is not the same as the number of parameter markers."

Does anyone have an example of calling a stored proc from the DB2 stage that actually worked?
Inquisitive
Charter Member
Charter Member
Posts: 88
Joined: Tue Jan 13, 2004 3:07 pm

Post by Inquisitive »

Hi All,
I have been going through the old posts on this forum, but not been able to get enough inputs.

Has anyone successfully invoked a udb stored procedure using db2 api stage.

Bigpopa, Any inputs for me... Pointers would be appreciated

Thanks
normgreen
Participant
Posts: 1
Joined: Mon Jul 12, 2004 12:20 pm

Post by normgreen »

Have there been any updates on this topic from the Ascential releases? or does someone have an example of a query that works. We are executing in test on a one server machine (DB2 and DS on same server). In production we have DS on one server and DB2 on another. The call statement used in test does not work in production. We have checked the dsenv and brought in all of the env variables from the server. We get file not found as an error message. The call works from a command line on the DS server in production. SQL statements work as well in DS, we are just having issues with the call of a stored procedure in this environment within DS. Thanks for any assistance.
Post Reply