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: "Patrick S dot Leung" <pleung at easygroup dot com>
Subject: exec stored proc returns one extra row
Date: Apr 20 2000 6:14AM

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?

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