Any suggested workaround for this? I'm generating reports where I want to divide by zero - Oracle's suggested workaround is to substitute 1 for 0 - but this would create false statistics for my reports.
Printable View
Any suggested workaround for this? I'm generating reports where I want to divide by zero - Oracle's suggested workaround is to substitute 1 for 0 - but this would create false statistics for my reports.
the question seems to be what do you want a divide by zero to represent? a reallyreallyreally big number? you can't really divide by zero in any practical sense.
d.
DBAtrix is certainly correct. The question is what you expect the result to be when a value is divided by 0. There are mathematical arguments for both infinity and undefined. We have no way to represent infinity, but we do have NULLs to represent undefined. Therefore, the standard way this is handled is:
SELECT
---:Numerator / DECODE ( :Denominator, 0, NULL, :Denominator)
FROM
---DUAL
Hope this helps,
- Chris
thx DBAtrix and chrislong - i was approaching the problem from the wrong angle