I have an oracle query, and part of it calculates some value using DECODE. For example:
SELECT ..., (SELECT DECODE((SELECT 23 FROM DUAL), 0, null, (SELECT 23 FROM DUAL)) FROM DUAL) FROM ...
Here the value "23" is computed at runtime, and these are rather complex joins - several tables, use PARTITION BY , etc. Therefore, I want to avoid executing the same subquery if the value is not equal to "0". Is there a way to write something like this
SELECT ..., (SELECT DECODE ((SELECT 23 FROM DUAL) as test, 0, null, test) FROM DUAL) FROM ...
hanumant
source share