Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: accessing (packaged) procedure name within procedure
> > Does anyone know of a system variable or some kind of logic which
> > would return a string containing the name of the currently executing
> > procedure?
>
> It can not be done nor does it make any sense unless you are assuming an
> Oracle database with a single connected user.
I'll admit that my question may not have been clear, but it does make sense in the context asked -- no matter how many users are connected. Any particular procedure is always running as a particular user ... either as the owner or the caller (using authid). If procedure X is called by procedure Y, then it is legitimate to believe that procedure Y can identify procedure X without any special arguments from X. Indeed, this works when X is not wrapped in a package (see dbms_utility.format_call_stack).
> v_$sga
> v_$open_cursors
> v_$sql_area
> v_$sessions
I cannot see how v_$sga or v_$sga_area could possibly be of use here. I am less familiar with v_$open_cursors, but scanning the contents, it does not appear an entry is made for each procedure execution. Perhaps I am missing something obvious here, though.
One potential solution is just to have a variable local to each packaged procedure/function which identifies the procedure/function by name. This variable could then be passed to any procedure/function needing to know the name of its predecessor. I was hoping to avoid this ...