PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: returning a parameter from a stored procedure in sybperl
Date: Mar 25 1998 3:43PM

TWJuan wrote:
> 
> Michael -
> 
> I need to return a parameter from a stored procedure call from
> within a sybperl program.  Can you point me in the direction
> to how to do this.  Thanks a lot!

See the dbretdata() call.

Essentially, assuming a sproc that returns an int param, it's

$dbh->dbcmd("declare @foo int \n");
$dbh->dbcmd("exec my_sproc 1, 2, 3, @foo output\n");
$dbh->dbsqlexec; $dbh->dbresults;
while(@dat = $dbh->dbnextrow) {
	# do something here if the sproc returned any rows...
}
@ret = $dbh->dbretdata;

# now $ret[0] is the content of @foo.

Be sure to add appropriate error checking....

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@datamig.com    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com