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: Stored Procedures Problem
Date: Jan 25 1999 6:15PM

>>>>> "Morgan" == Morgan Curley  writes:

Morgan> Michael Peppler wrote:
>>>>> "Morgan" == Morgan Curley  writes:
Morgan> Hey folks, I am writing a CGI that needs to retrieve lots of
>>> records totaled and broken down by date. I am using a stored
>>> procedure that selects all the dates then opens a cursor and
>>> selects the ind pages by day. Does this sound like something
>>> Sybase::DBlib doesn't support. I get no results DBCOUNT=-1 and
>>> DBROWS=0. If I run this through isql I get plenty of info
>>> returned.

>> This should definitely be supported. Could we see the perl code
>> (and maybe the stored proc) that you are using?
>> 
>> Michael -- Michael Peppler -||- Data Migrations Inc.
Morgan> Okay, here is the subrotuine I call this from($debug logs my
Morgan> SQL statements and results). The stored procedure is below
Morgan> also.

OK - this is the usual problem.

You are not calling dbresults() in a loop, until it returns
NO_MORE_RESULTS. Each SELECT statement in your stored proc generates a 
new result set. Executing *any* SQL *should* be done like this in
DBlib:

$dbh->dbsqlexec;
while($dbh->dbresults != NO_MORE_RESULTS) {
    while(@dat = $dbh->dbnextrow) {
	...
    }
}

to be sure to actually process all the results that the SQL
statement(s) generate.

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