On 4/16/2010 10:54 AM, Tom Deskevich wrote:
GLENN, can you create a working example like you did with DB2 options?
Thanks!
Tom Deskevich
Here you go...
Stored procedure:
CREATE PROCEDURE GETPROCS
(in LibName char(10))
RESULT SETS 1
LANGUAGE SQL
BEGIN
declare stmt varchar(1000);
DECLARE c1 CURSOR with hold with return to client for S1;
set stmt = 'SELECT SPECSCHEMA, SPECNAME from SYSPROCS where
SPECSCHEMA = ''' || LibName || '''';
prepare S1 from stmt;
OPEN c1;
DECLARE c1 CURSOR with hold with return to client for S1;
set stmt = 'SELECT SPECSCHEMA, SPECNAME from SYSPROCS where
SPECSCHEMA = ''' || LibName || '''';
prepare S1 from stmt;
OPEN c1;
SET RESULT SETS CURSOR c1;
END
PHP:
<?php
$user = "";
$password = "";
$i5_connection = i5_connect( '127.0.0.1', $user, $password,
array(I5_OPTIONS_ATOMATIC_NEXT_RESULT=>"1") );
$storedProcedure = "call GETPROCS(?)";
$result =i5_prepare($storedProcedure);
if(!$result)
{
echo("Prepare failed");
exit();
}
// Describe first parameter
$ret = i5_paramdesc($result, I5_TYPE_CHAR, 0, 10, 0, I5_IN);
$val = "QSYS";
$ret = i5_setparam($result, 0, $val);
if(!$ret)
{
echo("Set Param failed");
exit();
}
$hdl = i5_execute($result);
echo "</br></br>";
echo "<table><tr><td>Library</td><td>Procedure</td></tr>";
while($row = i5_fetch_row( $result, I5_READ_NEXT )){
$SCHEMA = $row[0];
$PROC = $row[1];
echo("<tr><td nowrap>$SCHEMA </td>
<td nowrap>$PROC </td></tr>");
}
echo "</table>";
?>
As an Amazon Associate we earn from qualifying purchases.