DECLARE
x number := 0;
y number;
BEGIN
select log(10,x)
into y
from dual;
END;
/
The PL/SQL block above returns following error:
ORA-01428: argument '0' is out of range
ORA-06512: at line 5
But if I change the way I assign the value to y, the error will be much more generic.
DECLARE
x number := 0;
y number;
BEGIN
y := log(10,x);
END;
/
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 5
Now, this is a trivial case, but imagine a situation where you initially wrote the code in a certain way and then it turns out you have to change completely the approach for some reason, a business request, code refactoring, whatever.
If there is an EXCEPTION block catching a specific error, ORA-01428 for instance, after the change it won't catch that error any longer, presumably with some consequences for the final outcome of the procedure or function.
No comments:
Post a Comment