🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #984

Re: IF condition

#984
From: aleplgr
Date: Wed, 04 Apr 2007 16:24
25 lines
1671 bytes
Ahhhh right, ok thanks

"Craig Stuntz [TeamB]" <craig_stuntz@nospam.please [a.k.a. acm.org]> wrote:
>aleplgr wrote:
>
>> IF (SELECT COUNT(*) FROM TEMP WHERE (FLAG = 1) > 0) THEN
>> BEGIN
>> ...
>> END
>
>	*Don't* do this. It's *hugely* inefficient. Instead, do:
>
>IF (EXISTS (SELECT 1 FROM TEMP WHERE (FLAG = 1)) THEN BEGIN
>
>	Your version counts all records visible to your transaction, then
>throws the result away.
>
>	My version stops as soon as it finds one.
>
>-- 
>Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
>  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
>Borland newsgroup denizen Sergio Gonz�lez has a new CD of 
>  Irish music out, and it's good: http://tinyurl.com/7hgfr
Technical Details
Message-ID: <4613c343$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder2.cambrium.nl!feed.tweaknews.nl!hitnews.eu!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!feeder08.uucp.at!feeder10.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail
References: <4613772b$1@newsgroups.borland.com> <4613adcd@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,ba6f6a971f66229
X-Google-Attributes: gid114a0e,public
X-Google-Language: ENGLISH,ASCII
From: "aleplgr" <aleplgr@yahoo.es>
Sender: "aleplgr" <aleplgr@yahoo.es>
Reply-To: "aleplgr" <aleplgr@yahoo.es>
Subject: Re: IF condition
Newsgroups: borland.public.interbase.sql
X-User-Info: 80.58.205.38     
X-Forwarded-For: 80.25.195.180, 192.168.1.66
References: <4613772b$1@newsgroups.borland.com> <4613adcd@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4613c343$1@newsgroups.borland.com>
Date: 4 Apr 2007 08:24:51 -0800
X-Trace: newsgroups.borland.com 1175700291 207.105.83.66 (4 Apr 2007 08:24:51 -0800)
Lines: 26
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder2.cambrium.nl!feed.tweaknews.nl!hitnews.eu!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!feeder08.uucp.at!feeder10.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail