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: Mick Ghazey <mghazey at yahoo dot com>
Subject: Re: standard execution of stored proc
Date: Jun 16 1998 8:41PM

Here's an example that passes a parameter to a stored proc,
FeedInstance, and expects a value to be returned in the result set,
ErrorCode.

	print "Executing $StoredProcName\n";
	
	$dbh->dbrpcinit($StoredProcName,0);

	$dbh->dbrpcparam('@FeedInstance',0,SYBFLT8,-1,-1,$FeedInstance);
	$dbh->dbrpcparam('@ErrorCode',DBRPCRETURN,SYBINT4,1,-1,$ErrorCode);

	$dbh->dbrpcsend;
	
	print "$StoredProcName returned $Status status\n"
		if $Status = $dbh->dbretstatus;

	while($dbh->dbresults != NO_MORE_RESULTS){
		my @row;
		while(@row = $dbh->dbnextrow){
			print "Results: @row\n";
		}
	}




---Lee Falkenhagen  wrote:
>
> I need to execute several different stored procedures.  Each proc 
> executes update statements.  There should be no data returned except
for 
> the return code.  It seems to me that I have two options:
> 
> 1) use sql()
> 
> $::dbh->sql("exec proc_update_history")
> 
> But, I don't know how to get the return code...
> 
> or
> 
> 2) use standard dbcmd, dbsqlexec, dbresults
> $::dbh->dbcmd("exec proc_update_history");
> $::dbh->dbsqlexec; $::dbh->dbresults;
> $l_status = $::dbh->dbretstatus;
> 
> Do I need to do anything with dbnextrow?  If the procedure does
return 
> rows because of a select somewhere, I usually want to ignore them.
> 
> Thanks
> 
> Lee Falkenhagen
> Certified Sybase Professional
> falkenl@hotmail.com
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> 
> 

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com