Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: ct_fetch() with a stored proc.
Date: Jan 7 2002 5:39PM

Monty Charlton writes:
 > Hello,
 > My stored proc. should return only one row of data, but ct_fetch() loops 
 > three times.  Plus, if I try to ct_cancel it, I get an error.  What could I 
 > possibly be doing wrong:

You're not doing anything wrong - you're just not realizing that the
stored proc will also return the status result (CS_STATUS_RESULT),
which is a one row result with the return code from the proc (usually
0, unless the proc fails or you use an explicit RETURN statement).

In addition you have one parameter specified as CS_RETURN, so that
will generate a CS_PARAM_RESULT (from the parameter declared OUTPUT in
the proc definition).

So that is why you get the three results - which you should fetch, and
possibly discard if you don't need them.

Michael Peppler - Data Migrations Inc. - -
International Sybase User Group -