------------------ SQL ------------------
------------------------------------------
-- RecordSet from journal for user_id --
-- call: dmt_selectContentBillingSet --
------------------------------------------
create procedure dmt_selectContentBillingSet (in spUser_id integer)
language sql
begin
declare sqlstate char(5) default '00000';
declare resultSet
cursor with return to client for
select contentID,datum,value
from journal
where user_id=spUser_id;
open resultSet;
end @
------------------ PERL ------------------
#!/usr/local/bin/perl
use DBI;
use DBD:

B2::Constants;
$user_id=111;
$database='dbi

B2:damit1';
$user='damit';
$password='timad';
$dbh = DBI->connect($database, $user, $password)
or die "Can't connect to $database: $DBI::errstr";
if (!defined($dbh)) { exit; }
$stmt = "call dmt_selectContentBillingSet(?)";
$sth = $dbh->prepare($stmt);
$sth->bind_param_inout(1,\$user_id,10);
$sth->execute();
do
{
while( @row = $sth->fetchrow_array ) {
print $row[0]." ",$row[1]." ",$row[2]."\n";
}
} while ($sth->{db2_more_results} );
# close selection criteria cursor
$sth->finish();
$dbh->disconnect();