This content has been marked as final. Show 3 replies
DECODE is an IF THEN ELSE function with commas separating the command names.
For example, DECODE(a,b,c,d) means IF a = b THEN c ELSE d
So in your case, DECODE(NVL(FTE Days Available SUM,0),0,0,FTE Days Absent SUM/FTE Days Available SUM) this means:
IF NVL(FTE Days Available SUM,0) = 0 THEN 0 ELSE FTE Days Absent SUM / FTE Days Available SUM
Basically it calculates the percentage of days absent compared to days available. However because we cannot divide by a NULL or zero this is why you have to just use zero whenever FTE Days Available is NULL or zero.
Hope this helps
Thank you for the information.
What I am still unsure about is the NVL(FTE Days Available SUM,0) part
- does it sum the FTE Days Available values before it considers whether they are null?
does it sum the FTE Days Available values before it considers whether they are null?Yes it does. But you will only get a null for the sum some if all the values in the sum are null or there are no values to sum.