----- Original Message -----
From: Steve Howard <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, July 08, 2001 4:47 AM
Subject: RE: Checking for the existence of a certain row.


> OK, one more yes-no. I tried this for performance and as expected, it is
> faster than count on MS and Sybase (and count is very fast on MS). You
might
> see if there is a variation of it you can use with the Oracle Decode
> function....I can't answer if there is or not, however in either case even
> though this is probably faster, it won't be portable between some dbms's.
>
> SELECT CASE
> WHEN EXISTS(SELECT somecolumn FROM customers WHERE columnname
='thisvalue')
> then 1
> ELSE 0
> END
>

You could also issue a:
select count(keyfield)
from sometable
where someclause

I did some benchmarks and found that is was faster then a where exists.

Maarten.


Reply via email to