create table errors (when_occurred date, error_code varchar2(100));
declare
x number;
hold_err varchar2(100);
begin
x := 'a' + 'b';
exception
when others then
hold_err := sqlerrm;
insert into errors values (sysdate,hold_err);
commit;
end;
/
PL/SQL procedure successfully completed.
select to_char(when_occurred,'yyyy-mm-dd hh24:mi:ss')a,error_code
from errors;
Error
Time ERROR_CODE
------------------- -------------------------------------------------------------------------------
2005-05-26 09:10:02 ORA-06502: PL/SQL: numeric or value error: character to number conversion error
1 row selected.
***************************************************************************************************