meridian99
MIS
I was wondering if there is a way in a script of sql/pl code within the 'exception' block to capture a oracle error code to assist in debugging. My code is failing on an INSERT.
thanks
thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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.
***************************************************************************************************