Re: SQL question

From: Alan Evans <aevans_at_kaiwan.com>
Date: Wed, 29 Dec 1993 15:56:05 GMT
Message-ID: <CIt09H.12v_at_kaiwan.com>


: 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??
: >

<replies deleted>

Your table definition and how you load it also come into play here. I had the same question on a system I am currently working on. The column in question had a "NOT NULL" constraint on it, yet it still had a blank in the column. This got real sticky when I had to write some embedded SQL in a C program to update the column. If I tried to update the column and the host variable was type "char", I would get back a message saying that the "NOT NULL" constraint disallowed the storage of a blank. If I used a host variable of type "VARCHAR", I could update the column with a blank.

Just some random thoughts...

Alan Evans

-- 
-------------------------------------------------------------------
You can reach me at _at_

ICBM	:   33 39'	North
Received on Wed Dec 29 1993 - 16:56:05 CET

Original text of this message