iguanodon has asked for the wisdom of the Perl Monks concerning the following question:
... my $sth = $dbh->prepare("{?=call some_procedure(?, ?, ?)}"); $sth->bind_param_inout(1, \$status, 20); $sth->bind_param(2, $foo); $sth->bind_param_inout(3, \$bar, 20); $sth->bind_param_inout(4, \$baz, 20); ...
will run with no error, and the two out parameters (3 and 4) will be populated. But the return value of the procedure (parameter 1) is never set, it will contain whatever $status was initialized with.
The procedure definitely returns a value, I can see it in the DB2 procedure debugger, and I'm able to get the return value if I call the procedure from JDBC, so it must be the DBD::DB2 driver that isn't returning the value. This is a bummer because our Java programs rely on the return value to tell whether the procedure call was successful. I'd like the Perl code to work the same way. I could work around this in Perl by returning the the status in another out parameter or by just verifying that all of the out parameters contain valid data but I'd rather be able to just get the procedure return value if possible.
I'm using DBD::DB2 version 0.78 which I realize is rather old but upgrading will require a lot of regression testing, and I don't see anything in the docs for the latest DBD::DB2 version to suggest that it would behave differently with respect to handling of the return value. I'll try the latest DBD::DB2 on a different box but I thought it would be worth asking here first.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting return value of DB2 stored procedures
by Melly (Chaplain) on Oct 20, 2006 at 12:06 UTC | |
by iguanodon (Priest) on Oct 20, 2006 at 12:56 UTC | |
|
Re: Getting return value of DB2 stored procedures
by neilwatson (Priest) on Oct 20, 2006 at 13:14 UTC | |
by iguanodon (Priest) on Oct 20, 2006 at 13:34 UTC | |
by shanknbake (Initiate) on Jan 22, 2013 at 02:27 UTC | |
by iguanodon (Priest) on Jan 23, 2013 at 14:22 UTC | |
|
Re: Getting return value of DB2 stored procedures
by Fletch (Bishop) on Oct 20, 2006 at 13:08 UTC |