[ Note - this would probably be more appropriate on the sybperl-l  
  mailing list - see my home page for details ]

On Mon, 2003-02-24 at 16:11, Craig Pardey wrote:
> Hi,
> 
> I am relatively new to the world of Perl and am experiencing some problems executing 
> a particular Sybase stored procedure.
> 
> Basically, when the stored procedure is executed, the update occurs fine, but any 
> subsequent database calls produce the following error:
> 
> DB-Library error: Attempt to initiate a new SQL Server operation with results 
> pending.
> 
> The code that does the last working update looks like...

The problem is that if you don't call dbresults() properly you aren't
fetching all the result sets that are generated by the stored procedure
call. If you don't then you get the error that you see.

If you have result sets that you wish to discard then you have to
actually call dbnextrow() inside of the dbresults() loop:

while($dbh->dbresults != NO_MORE_RESULTS) {
   while(@d = $dbh->dbnextrow) {
       # throw away the data
   }
}

if($dbh->dbhasretstat) {
    $retstat = $dbh->dbretstat;
}

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
[EMAIL PROTECTED]                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html

Reply via email to