Re: SQL question

From: B C Zygmunt <bzy_at_ornl.gov>
Date: Tue, 28 Dec 1993 12:57:09 GMT
Message-ID: <1993Dec28.125709.3640_at_ornl.gov>


In article 13471_at_rossinc.com, davidmo_at_rossinc.com (David Moore) writes:
> I performed the following queries, searching for blank character fields:
>
> SQL> select count(*) from table_one where field_one = '';
>
> COUNT(*)
> ----------
> 0
>
> SQL> select count(*) from table_one where field_one = ' ';
>
> COUNT(*)
> ----------
> 21
>
>
> Can someone explain to me why the first query does not work and the
> second one does??
>
> Thanks,
>
> Dave
> --
> =============================================================
> David A. Moore | Phone: (415) 593-2500
> Ross Systems Inc. | E-mail: davidmo_at_rossinc.com

As a matter of fact, both queries work. In the second, you are specifying the blank character by enclosing a blank within quotes. In the first, there is nothing between the quotes. You wouldn't expect to be able to search for the letter 'A' by checking ''. A blank is no different. What you are really searching for in the first query is a null, but a null query cannot be framed in that manner.

Beverly Zygmunt
Oak Ridge National Lab Received on Tue Dec 28 1993 - 13:57:09 CET

Original text of this message