List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:February 17 2009 10:21am
Subject:Re: how to check for null in string
View as plain text  
Hi !


Johan De Meersman wrote:
> In SQL, the correct syntax is "IS NULL" or "IS NOT NULL".
> 
> Random programming languages more often than not have no decent support for
> NULL content, although your DB library might have an isnull() function or
> something similar. Once you've exported a field into a regular variable,
> however, most often NULL becomes indistinguishable from an emtpy string.

That is what "embedded SQL" has "indicator variables" for:
When you select (rather: "fetch") database values into host language
(say, C, Cobol, Pascal, ...) variables, you have two to receive them:
- The host variable for the real value,
- and an indicator variable (typically, int).

The indicator would be set to -1 for a NULL value, and it might use
positive values to denote strings lengths, truncations, or similar things.


Jörg

-- 
Joerg Bruehe, MySQL Build Team, Joerg.Bruehe@stripped
Sun Microsystems GmbH,   Sonnenallee 1,   D-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

Thread
how to check for null in stringPJ17 Feb
  • Re: how to check for null in stringJohan De Meersman17 Feb
    • Re: how to check for null in stringJoerg Bruehe17 Feb
    • Re: how to check for null in stringPJ17 Feb