Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: DECODE question
Doesn't seem to make a lot of sense. The decode is basically saying "If
NULL is the same as 'Y' then return acctd_amount_due_remaining else
return amount_due_remaining"
Since NULL is never the same as 'Y', the function will always return amount_due_remaining, so the expression may as well have read "sum(amount_due_remaining)".
Can you provide a bit more context that may help to indicate what the program author was trying to accomplish?
Martin
Josue Batista wrote:
>Given the following two columns:
>
>ACCTD_AMOUNT_DUE_REMAINING NOT NULL NUMBER
>AMOUNT_DUE_REMAINING NOT NULL NUMBER
>
>What does the following statement mean?
>
>sum(decode(NULL,'Y',acctd_amount_due_remaining,amount_due_remaining))
>
>What is the interpretation of the "DECODE(NULL,'Y',..."?
>
>Thanks in advance.
>
>
Received on Mon Nov 11 2002 - 20:09:29 CST