tags:

views:

32

answers:

1

what is the shell command for executing stored procedure in DB2 OS400.

CALLPRC PRC(SPNAME) PARM('','',5,'','') RTNVAL()

what is this one??

A: 

Assuming you've got a stored procedure called SPNAME, here's how you'd run it through SQL on DB2:

CALL SPNAME('', '', 5, '', '');

This of course assumes that you've already got a database connection through which you can execute SQL statements.

A couple of things you'll probably have to worry about:

  1. You will probably have to specify the program's library like this: CALL LIBNAME.SPNAME(...). Or you can use SET PATH=LIBNAME to provide a list of libraries to search.
  2. You will want to look into parameter binding. This will allow you to pass input values to the procedure and get back the output values.

This link explains how to execute a stored procedure in PHP using ODBC.

dmc
ok thanks. one quick question. i have a connection file . if i include that here , like just above calling this procedure, it will work?or i have to connect to db using commands
zod
I am not a PHP guy, so to be honest I'm not sure how it normally works. I did add a link to my answer which might help. Good luck!
dmc