Is there a variable name that stores name of the stored procedure currently running? Something similar to $0 in Unix.
CREATE OR REPLACE
PROCEDURE my_sproc(
param1 IN NUMBER,
)
AS
BEGIN
exec other_sproc(XXX);
END;
END;
XXX <- stores the string “my_sproc”.
Depending on the Oracle version, you may be able to use conditional compilation and
$$PLSQL_UNITIf
other_sprocjust prints out the value passed inthen in Oracle 11g, you can use
$$PLSQL_UNITin the callerThis doesn’t work as well when you are using packages though (and your stored procedures should almost always be in packages) because the
$$PLSQL_UNITwill be the package name not the procedure name.Note as well that you do not use
EXECin a PL/SQL block.EXECis a SQL*Plus command. You simply callother_sproclike I do here.