Hi all,
I would like to know how to write efficiently a query that calls a function with a result of another function call. Something that would look like
select empno, very_long_calculation(empno) as calc_result, calc_result * 5 as multiplied_calc_result from emp;
It's possible to write
select empno, very_long_calculation(empno) as calc_result, very_long_calculation(empno) * 5 as multiplied_calc_result from emp;
but, if I'm not wrong, in such case the same calculation would be performed twice (and I already have the result). It would be certainly possible to use the WITH clause but I'm curious if there is some more elegant way.
Regards,
Pavel