begin
dbms_output.put_line(utl_call_stack.dynamic_depth);
end;
/
Calling a procedure increases the depth by 1. The following example prints 2:
create or replace procedure tq84_print_dyn_depth as begin
dbms_output.put_line(utl_call_stack.dynamic_depth);
end;
/
begin
tq84_print_dyn_depth;
end;
/
This example prints 3:
create or replace procedure tq84_wrap_dyn_depth as begin
tq84_print_dyn_depth;
end;
/
begin
tq84_wrap_dyn_depth;
end;
/
Nested procedures also increase the depth: the following example prints 4:
create or replace procedure tq84_nesting_procs as
procedure nested_proc as begin
tq84_print_dyn_depth;
end;
begin
-- tq84_print_dyn_depth;
nested_proc;
end;
/
begin
tq84_nesting_procs;
end;
/
Cleaning up:
drop procedure tq84_nesting_procs;
drop procedure tq84_wrap_dyn_depth;
drop procedure tq84_print_dyn_depth;