Hi,
I have a database in Oracle 12.2.0
There I have deployed a PL/SQL logic which is called from an update trigger.
From this logic, following code segment is called to get the format call stack.
FUNCTION Format_Stack___ RETURN VARCHAR2
IS
call_stack_ VARCHAR2(32000);
depth_ PLS_INTEGER := Utl_Call_Stack.Dynamic_Depth();
BEGIN
FOR i_ IN REVERSE 1 .. depth_ LOOP
call_stack_ := call_stack_ || UTL_Call_Stack.Concatenate_Subprogram(UTL_Call_Stack.Subprogram(i_)) || ' at line ' || To_Char(UTL_Call_Stack.Unit_Line(i_)) || chr(10);
END LOOP;
RETURN stack_;
END Format_Stack___;
Running this code segment raises the
ORA-64610: bad depth indicator error with an error stack similar to below.
With the error:
ORA-64610: bad depth indicator
ORA-06512: at line 16
ORA-06512: at "APPOWN.EVENT_ACTION_API", line 2186
ORA-06512: at "APPOWN.EVENT_ACTION_API", line 2304
ORA-06512: at "APPOWN.ERROR_SYS", line 128
ORA-06512: at "SYS.UTL_CALL_STACK", line 99
ORA-06512: at "APPOWN.ERROR_SYS", line 113
ORA-06512: at "APPOWN.ERROR_SYS", line 119
ORA-06512: at "APPOWN.ERROR_SYS", line 323
ORA-06512: at line 3
ORA-06512: at "APPOWN.EVENT_ACTION_API", line 2300
ORA-06512: at "APPOWN.EVENT_ACTION_API", line 2309
ORA-06512: at "APPOWN.EVENT_ACTION_API", line 2159
ORA-06512: at "APPOWN.EVENT_ACTION_API", line 2192
ORA-06512: at "APPOWN.EVENT_SYS", line 199
ORA-06512: at "APPOWN.EVENT_SYS", line 199
ORA-06512: at "APPOWN.ORD_LINE_TR1", line 14
ORA-04088: error during execution of trigger 'APPOWN.ORD_LINE_TR1'
ORA-06512: at "APPOWN.ORD_LINES_API", line 4208131679
ORA-06512: at "APPOWN.ORD_LINES_API", line 29721
ORA-06512: at "APPOWN.ORD_LINES_API", line 30769
ORA-06512: at "APPOWN.ORD_LINES_API", line 30778
ORA-06512: at "APPOWN.ORD_LINES_API", line 22813
ORA-06512: at "APPOWN.ORD_LINES_API", line 22857
ORA-06512: at "APPOWN.ORD_LINES_API", line 22864Quite strangely, sometimes issue gets solved when the code segment is changed to below (only sometimes)
(only change here is call stack is merged in two lines)
FUNCTION Format_Stack___ RETURN VARCHAR2
IS
call_stack_ VARCHAR2(32000);
depth_ PLS_INTEGER := Utl_Call_Stack.Dynamic_Depth();
BEGIN
FOR i_ IN REVERSE 1 .. depth_ LOOP
call_stack_ := call_stack_ || UTL_Call_Stack.Concatenate_Subprogram(UTL_Call_Stack.Subprogram(i_)) ;
call_stack_ := call_stack_ || ' at line ' || To_Char(UTL_Call_Stack.Unit_Line(i_)) || chr(10);
END LOOP;
RETURN stack_;
END Format_Stack___;
I tried different articles in Oracle community & support. Most of them with this bad depth error was related UTL_SMTP.
Didn't find a good article on an error similar to this in UTL_Call_Stack.
Your valuable thoughts on this are welcome.
Thank You.
Navinth
You get the ORA-64610 error when the utl_call_stack procedures try to access a non-existent stack position. For example:
begin
dbms_output.put_line (
utl_call_stack.unit_line ( 100 )
);
end;
/
ORA-64610: bad depth indicator
There is a bug in 12.2 that raises this error (See MOS 2419817.1). But I'm not convinced this is the cause of your issue, as it relates to calling backtrace_unit.
We need a test case to see exactly when you get this exception though.
It's worth checking with support in any case.