Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: STR() not support correctly null variables
Message
De
16/05/2003 08:37:31
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00789137
Message ID:
00789162
Vues:
21
Hi Sergey,

try the following
nx=0
nx=NULL
?TYPE('NX')
?STR(nx)
nx='c'
nx=NULL
?TYPE('NX')
?STR(nx)
This is because STR() correctly checks for numeric types.
It should not produce an error for a NULL if the type is Numeric.
STR() can be used to numeric fields and fields may store NULL.
A SQL SELECT using STR correctly gives NULL for NULL and a string for !NULL.

Agnes

>Hi Fabio,
>
>I disagee with you. The parameter of the function is numeric expression so function correctly generates an error when you try to pass it variable of character data type. It should also generate an error when parameter is Null because it's not a numeric value. You can use NVL() function to handle nulls.
>
>>Hi
>>
>>x=NULL
>>? STR(null)
>>
>>OK : STR return NULL
>>BUG : NULL type is not "C"; LTRIM(),RTRIM()... return NULL "C" type correclty
>>
>>? STR(x)
>>
>>BUG: STR return error type
>>
>>For VFP Team: solution
>>
>>your internal code is:
>>if (parameterType#'C')
>> Error;
>>if (parameterValue=NULL)
>> return parameterValue;
>>
>>correct is ( LTRIM .. RTRIM uses this schema ):
>>if (parameterValue=NULL)
>> return charsNullvalue;
>>if (parameterType#'C')
>> Error;
>>
>>
>>Fabio
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform