in reply to How to get results back from SQL Stored Procedure using Perl

This part of the documentation of the DBI is relevant:
Calling stored procedures is currently not defined by the DBI. Some drivers, such as DBD::Oracle, support it in non-portable ways. See driver documentation for more details.
Which means that 1) prepare, execute, fetch is unlikely to work, 2) without knowing which driver you're using, any answer is going to be guesswork, and 3) be prepared that you may have to result to using a more specific interface to your database client libraries instead of the DBI, which implements the lowest common denominator, and hardly anything else.

Replies are listed 'Best First'.
Re^2: How to get results back from SQL Stored Procedure using Perl
by Anonymous Monk on Apr 03, 2012 at 21:27 UTC
    Sorry, using ODBC to connecto to AS400 database.

      Sorry, I don't have any experience on an AS/400. I assume you're using DB2, then? If so, you might find the IBM document Perl programming with DB2 Universal Database useful. It contains an example of calling a stored procedure. While it doesn't show how to retrieve a recordset from the stored procedure, further poking around on the IBM site may give you what you're looking for.

      Another place you can look is the test code (presumably) provided with the DBD::DB2 driver. If you don't have it on hand, just download it from CPAN and expand it locally, and go into the t directory. There ought to be a test for retrieving from stored procedures. I notice that the "what changed" document mentions a couple SPROC changes, including one about retrieving multiple recordsets.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.