Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL - Any data in this column?

Re: SQL - Any data in this column?

From: Ms. D.H. Harvey <qq45_at_liverpool.ac.uk>
Date: 23 Jan 2003 13:50:02 GMT
Message-ID: <b0orua$80d$1@news.liv.ac.uk>


,elziko <elziko_at_notspammingyahoo.co.uk> wrote:
: I want to check a ceratin column to see if it has any data for a certain ID.
: So I'm using this SQL:

: SELECT count(mycolumn)
: FROM mytable
: WHERE myid = 10
: AND mycolumn IS NOT NULL

: If that returns a number greater than zero I know there is data in the
: column. However, for my situation this is too slow. Is there a faster way?

: Cheers,

: elziko

Try

SELECT COUNT (*)
  FROM dual
  WHERE EXISTS ( SELECT NULL

                 FROM   mytable
                 WHERE  myid = 10
                 AND    mycolumn IS NOT NULL )
/

HTH Helen Received on Thu Jan 23 2003 - 07:50:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US