Null vs. Empty

Frank Schima frank-list3 at mindstarprods.com
Sat Nov 13 13:52:23 CST 2004


Hi guys,


Think of NULL as undefined or unknown. The len() of a Null text field 
is not defined/unknown and hence not zero. This is standard SQL 
database behavior - it is also the logical behavior when you think 
about it. The standard logic matrices for True, False and AND, OR XOR, 
etc. can be extended to include NULLs.

The bottom line is that you, the developer, have to define what *you* 
want to do with NULLs for your particular application.

So standard SQL practice to look for empty or NULL strings is the 
following:

    SELECT MyTextField
    FROM MyTable
    WHERE len(MyTextField) = 0 OR MyTextField is NULL

You could just not allow NULLs for the field. Or make sure that every 
time a record is added that it be set to an empty string by default.

Ruslan, in Valentina 2, can we remove the NULL flag from a Text field?


Best regards,
Frank

On Nov 13, 2004, at 12:31 PM, Ruslan Zasukhin wrote:

> On 11/13/04 9:25 PM, "jda" <jda at his.com> wrote:
>
>> I'm tired of talking through a browser...
>>
>>> NOT RIGHT, Jon.
>>
>>> NULL is not the same as EMPTY STRING!
>>
>>> NULL is not the same as ZERO for numeric fields!
>>
>>> This is why exists NULL
>>
>> You may be technically correct, but it is an empty victory. The NULL
>> issue is only of technical interest to you, I think. There is no
>> reason I can think of why a user wouldn't look for a field with a
>> length of 0 (to the user, it appears NULL) and expect to find a match
>> if there was nothing entered in it.
>
> Then it is your responsibility to build façade for user.
>
>
>> When I do my own searching it doesn't matter what the rules are -- I
>> will obey them. But since I let my user enter SQL searches manually,
>> it would be friendlier to them if the logical result was the real
>> result.
>
> Jon.
>
> Len(0) never will return records that are NULL. POINT.
>
> Not an issue for discussion.
>
> This is SQL __standard__
>
>> I've made my point, and I'm not going to press this any more. There
>> are more important issues to resolve.
>
> Yes, and you need think how "resolve" this for your users.
>
> -- 
> Best regards,
> Ruslan Zasukhin      [ I feel the need...the need for speed ]
> -------------------------------------------------------------
> e-mail: ruslan at paradigmasoft.com
> web: http://www.paradigmasoft.com
>
> To subscribe to the Valentina mail list go to:
> http://lists.macserve.net/mailman/listinfo/valentina
> -------------------------------------------------------------
>
>
> _______________________________________________
> Valentina-beta mailing list
> Valentina-beta at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina-beta
>



More information about the Valentina-beta mailing list