I have a select statement that returns one value that goes something like this:
select decode(sign(nvl(sum(a), 0), nvl(sum(b)/sum(c)),0), 1, decode(sign(nvl(sum(b),0) / nvl(sum(c),0)), -1, 5), 2)
now, the select above is just an example and the one im using is actually longer than that, uses 3 more decodes in that first decode.
Now, would this be code optimization or should i do one select returning the sum value of a, b, c and then do my calculation in a series of if/else statements?
Thanx in advance
If u use oracle 8i and 9i u may use CASE expression.
DECODE() and CASE .. WHEN .. on server side
in any case faster then IF/ELSE on client side.