|
|
sybperl-l Archive
Up Prev Next
From: Adam Witney <witneya at nmripo dot nmri dot nnmc dot navy dot mil>
Subject: using stored procedures through DBI/DBD-Sybase
Date: Jan 24 2000 8:36PM
Hi,
I am not sure if this is a DBI or a DBD-Sybase question, but when i
use the following set of statements
1> declare @gene_id int
2> exec p_gene 2,1,1,1,19, @gene_id output
3> select gene_id, locus from gene where gene_id = @gene_id
4> go
(return status = 0)
-----------
35
(1 row affected)
gene_id locus
----------- --------------------
35 PFB0175c
(1 row affected)
through sqsh i get the correct output.... as listed above.
However when i try to pass this through a perl script, then i just
get the return value of the stored procedure passed back... which is
0 in this case. Is there a special way of trying to do this with
DBI/DBD?
here is the perl script being used
#########################################
#! perl -w
use strict;
use DBI;
my $dbh = DBI->connect("dbi:Sybase:SYBASE", $user, $passwd)
|| die "cannot connect: $DBI::errstr";
my $sql = qq{declare \@gene_id int
exec p_gene 2,1,1,1,19, \@gene_id output
select gene_id, locus from gene where gene_id = \@gene_id};
my $sth = $dbh->prepare($sql);
$sth->execute;
DBI::dump_results($sth);
$sth->finish;
$dbh->disconnect;
###########################################
any help would be greatly appreciated
thanks
adam
|