exp function and numberic overflow ORA-01426
554928Dec 8 2008 — edited Dec 8 2008I've got a problem that has been driving me slightly mad over the past few days. I have been trying to code some actuarial functions that I don't really understand for a data warehouse load on Oracle 9.2.0.6
I am trying to use exp() and power() functions in an insert statement. There is some slightly dodgy data in the source table that is causing a numeric overflow to occur for some rows so I have written a function which calculates the values and returns the result. If an exception occurs, this will be caught and the result set to 0.
The problem I am finding is that within the function, the power() function will successully raise a value_error exception when a problem occurs. However, the exp() function will not. When calling exp() with a large number as the parameter, it will simply return 1e126, which will subsequently cause a numeric overflow when calculating the value for another column.
However, the number overflow will be raised if I use select exp(...) into ... from dual
Is this just a weird inconsistency between the SQL and PL/SQL engine. I thought these problems had been resolved with Oracle 9 but I guess not.
I think I can probably work-around the problem for here, just looking for confirmation that my thoughts are correct.