Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reusing variables
Message
De
29/08/2008 18:08:33
 
 
À
29/08/2008 18:05:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01343407
Message ID:
01343412
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
select nvl(sum(apr),0) from crsRpt where fisyear = fy into array a1
>Thanks
>I could do it with less code just by resetting a1 = 0 each time. I just wondered if there was a way to do it inside the select.
>
>
>>ALWAYS check _tally!
>>select sum(apr) from crsRpt where fisyear = fy into array a1
>>if _tally>0
>>   replace aprTotal with nvl(a1,0)
>>endif
>>select sum(may) from crsRpt where fisyear = fy into array a1
>>if _tally>0
>>   replace mayTotal with nvl(a1,0)
>>endif
>>select sum(jun) from crsRpt where fisyear = fy into array a1
>>if _tally>0
>>   replace junTotal with nvl(a1,0)
>>endif
>>>Given a sequence like this
>>>select sum(apr) from crsRpt where fisyear = fy into array a1
>>>replace aprTotal with nvl(a1,0)
>>>select sum(may) from crsRpt where fisyear = fy into array a1
>>>replace mayTotal with nvl(a1,0)
>>>select sum(jun) from crsRpt where fisyear = fy into array a1
>>>replace junTotal with nvl(a1,0)
>>>you would think that if the select came up empty the array a1 would become null. However I find that instead of being reset to null the array simply carries over with its prior value. Is there a way to insure that it will be null if the select is empty?
>>>
>>>Thanks
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform