Search code examples
stored-proceduresibm-midrangedb2-400

On IBM i, how to run a stored procedure via DB2 command of QShell?


How would you run a stored procedure via DB2 command of QShell, as I need a simple way to unit test a change to a stored procedure?

On IBM i

Started qshell with

QSH

Entered these db2 commands in various formats without success

db2 call libraryname.stroredprocedurename('param1value' 'param2value' ?)

db2 call libraryname.stroredprocedurename ('param1value' 'param2value' ?)

db2 call libraryname.stroredprocedurename (param1value  param2value ?)

Only reference source I could find

Have tried using CLP to call stored proceduresbut there are no CLP examples here


Solution

  • I use Squirrel SQL Client http://squirrel-sql.sourceforge.net/ to test all of my SQL.

    call libraryname.stroredprocedurename('param1value', 'param2value')
    

    Note the separator is a comma ,, and ? is not a valid parameter marker when called interactively like this.

    In addition to the client, you will need a JDBC driver. You can use the JTOpen driver for IBM i found here: http://jt400.sourceforge.net/