On Mon, 2002-04-08 at 09:39, Rune Hegrenes wrote:
> Hi
> 
> I'm trying to execute a stored procedure in my database from Perl.
> I seen get only the first resultset from the procedure, not the rest (the procedure 
>returns 4 resultsets).
> How do I do this?
> 
> I'm using the DBI::Sybase package. Is there any documentation on this package?
> 
> 
> Rune

For docs type 'man DBI::Sybase' or 'perldoc DBI::Sybase'.  As for why
you are only getting the first row back, I can't say without looking at
your code, but here is an example of how I do it with Informix.

#!/usr/bin/perl

use strict;

my $dbh = DBI->connect(
        'dbi:Informix:stores7',
        '',
        '',
        {
                ChopBlanks => 1,
                RaiseError => 1,
                PrintError => 1,
                AutoCommit => 0
        }
);

my $sth = $dbh->prepare("execute procedure test_proc()");

$sth->execute;

while (my ($id, $name, $number) = $sth->fetchrow_array) {
        print "id = [$id] name = [$name] number = [number]\n";
}

$sth->finish;
$dbh->disconnect;

or if you have a new enough version of the DBI you can do this


#!/usr/bin/perl

use strict;

my $dbh = DBI->connect(
        'dbi:Informix:stores7',
        '',
        '',
        {
                ChopBlanks => 1,
                RaiseError => 1,
                PrintError => 1,
                AutoCommit => 0
        }
);

my $result_sets = $dbh->selectall_arrayref("execute procedure
test_proc()");

foreach my $ref (@$result_sets) {
        my ($id, $name, $number) = @$ref;
        print "id = [$id] name = [$name] number = [number]\n";
}

$dbh->disconnect;

-- 
Today is Pungenday the 25th day of Discord in the YOLD 3168
Wibble.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to