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 peppler dot org>
Subject: Re: exec stored proc returns one extra row
Date: Apr 20 2000 2:13PM

Patrick S. Leung writes:
 > Hi,
 > 
 > I implemented a complex select statement using a stored proc, and I use
 > sybperl to exec that stored proc.  However, the result array has one
 > additional empty row, compared with the right number of rows if I would
 > have execute the query ad hoc.  Would anyone has an idea?

The extra row is the stored proc status return value - $restype will
be CS_STATUS_RESULT instead of CS_ROW_RESUULT.

Michael


 > 
 > for example:
 > 
 > $query_string = "EXEC my_stored_proc "
 > $X->ct_execute($query_string);
 >  while(($rc = $X->ct_results($restype)) == CS_SUCCEED) {
 >          next unless($X->ct_fetchable($restype));
 >   while(@dat1 = $X->ct_fetch) {
 >         print $dat[0];
 >         }
 > }
 > 
 > 
 > $query_string = complex query;
 > $X->ct_execute($query_string);
 >  while(($rc = $X->ct_results($restype)) == CS_SUCCEED) {
 >          next unless($X->ct_fetchable($restype));
 >   while(@dat1 = $X->ct_fetch) {
 >         print $dat[0];
 >         }
 > }
 > 
 > 
 > The first one would print one more time than the second one.
 > 
 > thanks, Patrick
 > 

-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com