'If' .. Then statement in Teradata ?

General
Enthusiast

'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! 

2 REPLIES
Enthusiast

Re: 'If' .. Then statement in Teradata ?

Got it,

CASE WHEN Billed_Amount = 0.000 THEN

'No_Chrg'

ELSE Billed_Amount

END AS Billed_Amt

Enthusiast

Re: 'If' .. Then statement in Teradata ?

The option you put would work for sure, there is one more way you can do it -

COALESCE(NULLIFZERO(Billed_Amount),'No_Charge')