Display line number where error occurred in DB2 stored procedure
3
votes
2
answers
1630
views
I have added an EXIT handler in my procedure that captures the SQLSTATE and SQLCODE, and even found a way to get the procedure name, but I also need to know where the error occurred. Suggestions greatly appreciated.
declare EXIT handler for SQLEXCEPTION
begin
select sysibm.routine_specific_name, SQLSTATE, SQLCODE
into v_sp_name, v_sqlstate, v_sqlcode
from sysibm.sysdummy1;
call dbms_output.put_line('Error in '||v_sp_name ' ['||v_sqlstate, v_sqlcode||']');
end;
Asked by Jake v1
(73 rep)
Jan 21, 2021, 02:42 PM
Last activity: Jan 21, 2021, 05:06 PM
Last activity: Jan 21, 2021, 05:06 PM