Is there a way to rename an oracle stored procedure, without having to drop and recreate the procedure?
You can effectively rename a stored procedure by simply creating another procedure - with the new name - that simply calls the old procedure. Here is an example.
create or replace procedure new_procedure_name(variables in type)as
begin
old_procedure_name(variables in type);
end;
/
[oracle@rh4racdb01 gary]$ cat demo.sql
create or replace procedure test_sql(aa in char)
as
begin
delete from emp where empno=10000;
commit;
end;
/
[oracle@rh4racdb01 gary]$ cat demo_rename.sql
create or replace procedure test_sql_old(bb in varchar2)
as
begin
test_sql(bb);
end;
/
scott@RACDB>@demo.sql
Procedure created.
scott@RACDB>@demo_rename.sql
Procedure created.
scott@RACDB>select object_name,OBJECT_TYPE from user_procedures;
OBJECT_NAME OBJECT_TYPE
------------------------------------------------------------ -------------------
TEST_SQL PROCEDURE
TEST_SQL_OLD PROCEDURE