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: "Raja Sambamurty" <rajags at hotmail dot com>
Subject: Re: Error when checking
Date: May 26 1998 6:57PM

Rashmi,

I don't think the sql line you have with (if exists...) is the problem. 
I use this all the time and often end the sub with a $dbh->sql ($sqlcmd) 
where sqlcmd actually has the whole "if .." logic in it. I think you 
might have some pending results with any of your prior sql commands. 
This is another reason I like to use the ->sql command as opposed to 
dbexec+dbresults+nextrow combo. my $0.2 worth

Raja

>From owner-sybperl-l@listproc.net Tue May 26 10:16:21 1998
>Received: from localhost (localhost [127.0.0.1])
>	by list.cren.net (8.8.7/8.8.7) with SMTP id MAA28184;
>	Tue, 26 May 1998 12:59:32 -0400 (EDT)
>Received: from send1b.yahoomail.com (send1b.yahoomail.com 
[205.180.60.23])
>	by list.cren.net (8.8.7/8.8.7) with SMTP id MAA28110
>	for ; Tue, 26 May 1998 12:57:54 -0400 (EDT)
>Message-ID: <19980526165724.22407.rocketmail@send1b.yahoomail.com>
>Received: from [205.227.60.66] by send1b; Tue, 26 May 1998 09:57:24 PDT
>Date: Tue, 26 May 1998 09:57:24 -0700 (PDT)
>From: Rashmi Anand 
>Subject: Error when checking "if exists"
>To: SybPerl Discussion List 
>MIME-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Reply-To: SYBPERL-L@listproc.net
>Sender: owner-SYBPERL-L@listproc.net
>X-Listprocessor-Version: 8.2.06 -- ListProc(tm) by CREN
>
>Hello, 
>I am trying to check for the existance of a row and if it exists, send
>an update otherwise, send an Insert statement:
>
>if exists (select * from ... where ...)
>   begin 
>     Update ... where ...
>   end
>else
>   begin 
>     Insert ...
>   end
>
>and I get the following error:
>
>DB-Library error: Attempt to initiate a new SQL Server operation with
>results pending.
>
>I don't think the above SQL is returning any results, and I am not
>expecting any, then why is dblib throwing the above error?
>
>Any help will be appreciated.
>Thanks in advance
>--Rashmi
>
>
>
>
>_________________________________________________________
>DO YOU YAHOO!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com