Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename an Oracle procedure

Is there a way to rename an oracle procedure, without having to drop and recreate the procedure?

like image 360
ash Avatar asked Feb 08 '10 11:02

ash


People also ask

How do I rename a procedure?

To rename a stored procedureExpand Databases, expand the database in which the procedure belongs, and then expand Programmability. Determine the dependencies of the stored procedure. Expand Stored Procedures, right-click the procedure to rename, and then click Rename. Modify the procedure name.

Can you rename an Oracle package?

So you can load code using "Loas in Editor" option, change name of package and then execute script. It will create new package with new name.

How do you rename a function in PL SQL?

If you really need to use a new name for the function without simply recreating the function with the new name change you might be able to take advantage of: SQL> create or replace synonym f2 for f1; Synonym created.

What is rename in Oracle?

Use the RENAME statement to rename a table, view, sequence, or private synonym. Oracle Database automatically transfers integrity constraints, indexes, and grants on the old object to the new object.


2 Answers

UNfortunately there is no equivalent of ALTER TABLE ... RENAME TO for PL/SQL objects. So I'm afraid you will have to drop the procedure and create it afresh with the new name....

... unless using a SYNONYM will resolve your bind. Without knowing why you want to change the procedure name it's a bit difficult to give advice.

like image 170
APC Avatar answered Oct 04 '22 23:10

APC


A way around this would be using a procedure inside a package. Then you might use CREATE OR REPLACE PACKAGE ... and CREATE OR REPLACE PACKAGE BODY ... to achieve your goal.

like image 29
Pavel Mitrofanov Avatar answered Oct 04 '22 23:10

Pavel Mitrofanov