Can PL/SQL procedure in Oracle know it's own name?
Let me explain:
CREATE OR REPLACE procedure some_procedure is
v_procedure_name varchar2(32);
begin
v_procedure_name := %%something%%;
end;
After %%something%%
executes, variable v_procedure_name
should contain 'SOME_PROCEDURE'. It is also OK if it contains object_id
of that procedure, so I can look up name in all_objects
.
You can use the connections tab which is in the left side of sql developer. Show activity on this post. Browse to the connection name in the connections tab, expand the required object and just click, it will open the code in new tab.
A stored procedure in PL/SQL is nothing but a series of declarative SQL statements which can be stored in the database catalogue. A procedure can be thought of as a function or a method. They can be invoked through triggers, other procedures, or applications on Java, PHP etc.
Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then click View Dependencies. View the list of objects that depend on the procedure. View the list of objects on which the procedure depends.
Try:
v_procedure_name := $$PLSQL_UNIT;
There's also $$PLSQL_LINE if you want to know which line number you are on.
If you are pre-10g, you can 'dig' (parse) it out of dbms_utility.format_call_stack Procedures/functions in packages can be overloaded (and nested), so the package name/line number is normally better than the name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With