All Forums General
DataHead 34 posts Joined 01/13
21 Apr 2013
'If' .. Then statement in Teradata ?

HI,
I need to find a way to SUM a field where, IF it contains a '0', I want to replace it with some text or any other value.
So the value isn't NULL & NULLIF won't work.
The syntax would be something like 'IF((SUM(Billed_Amount) = '0'), 'No_Charge')).
Thanks for any suggests! 
 

DataHead 34 posts Joined 01/13
21 Apr 2013

Got it,
CASE WHEN Billed_Amount = 0.000 THEN
'No_Chrg'
ELSE Billed_Amount
END AS Billed_Amt

KS42982 137 posts Joined 12/12
21 Apr 2013

The option you put would work for sure, there is one more way you can do it -
COALESCE(NULLIFZERO(Billed_Amount),'No_Charge')
 

You must sign in to leave a comment.