How can I call a DB2 stored procedure with OUT parameters from SQuirreL SQL?

KC Baltz picture KC Baltz · Feb 16, 2011 · Viewed 47.9k times · Source

I really like SQuirreL SQL as a SQL query tool, but I've never been able to get it to call stored procedures in our AS/400 DB2 database. I always get the error "The number of parameter values set or registered does not match the number of parameters." I've double-checked the number of params and had no luck. This is the syntax I've tried for a procedure that takes one IN and one OUT:

call SOMESPROC(12345, ?);

Answer

farbgeist picture farbgeist · Aug 17, 2016

It seems that SQuirrel currently is not capable of doing that on AS/400 DB2.

Using the open source "SQL Workbench/J" (http://www.sql-workbench.net/) I was able to call a procedure:

wbcall SOMESPROC(12345, ?);

It has its own command for calling a procedure "wbcall". Use ? for out parameters.

Note: While installing SQL Workbench/J make sure to download the right DB2 driver from IBM and also add the licence file while adding the driver inside SQL Workbench/J.