Give me an example using iif(isnull(....)) statement and what for it is used?

Questions by meena.krishnan

Showing Answers 1 - 4 of 4 Answers

RAGHU

  • Jun 29th, 2006
 

iif=immediate if

iif(isnull(date,0,to_char(date,'yyyy-mm'))

if date is not null then 0 else to_char(date,'yyyy-mm');

AS SIMPLE AS IT

  Was this answer useful?  Yes

Rupesh

  • Dec 27th, 2018
 

IIF(cond as expression, expr1 as expression, [expr2 as expression])
Returns the value of expr1 if the cond is true or the value of expr2 if the cond is false.
In your case, If (condition) date IS NULL (returns true) then 0 (expr1)
else to_char(date,yyyy-mm) (expr2)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions