Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select (SQL) -- field does not accept NULL values
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00692839
Message ID:
00693177
Vues:
15
Kevin,

>But I really need to know why this is a "bug"? Selecting fields that have a NULL in them works fine, it is only when a variable (ora command) that results in a NULL does the problem exist like in :

>
>select proper(Table1.Name) as NewName from table1 into cursor temp
>
>My question is why does this cause an error???

.NULL. is always a little different than all the other things <g>.

.NULL. has no datatype (as Garrett already said). Using Proper() on something that is not of type character cannot work. You have to use NVL() here. Be also aware of the fact, that you cannot compare .NULL. with something else.

You cannot put something like SELECT * FROM table WHERE field1 = .NULL. You won't see any fields that conatin .NULL. in field1. You'll have to use field1 IS NULL in that case. So if you wanted to get all rows from a table that have an empty string or .NULL. in field1 you'll have to SELECT * FROM table WHERE field1 = '' OR ISNULL(field1).

Since .NULL. isn't even something, you could say, .NULL. doesnt't even exist <s>. That's why a comparison between "nothing" and "nothing" equals to "nothing". You're comparing something that doesn't really exists. And that cannot result in .T. or .F.

If Proper() or any command that works on any real existing datatype doesn't work with .NULL. It's the way it is. It's not a bug. BTW: some DBMS allow comparisons with = .NULL.

Hope my weird explanations ;-) are of any help ... simply think of .NULL. as nothing. That should make things clearer for you.

Armin

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform