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: Whats the best way to call an stored procedure and get the status using ctlib?
Date: May 19 1998 10:14PM

Steve Allen writes:
 > Folks,
 > 
 > I am trying to call a stored procedure using the ctlib extentions in
 > sybperl, whats the simplest method, I have looked at the examples in the
 > eg directory but unsure on the syntax for my example.
 > 
 > call change_status int,datetimeval,char(10)
 > 
 > And returning the status to see if it succeeded?

$dbh->ct_execute("exec change_status $i, '$date', '$string'");
while($dbh->ct_results($restype) == CS_SUCCEED) {
	if($restype == CS_STATUS_RESULT) {
	   ($status) = $dbh->ct_fetch;
        } elsif($dbh->ct_fetchable($restype)) {
           # don't know if your proc could return regular rows. If it
           # does you can handle that here
	   while(@dat = $dbh->ct_fetch) {
		....
	   }
	}
}

print "change_status returned status $status\n";

__END__

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