Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename a mysql procedure

Does anyone know what is the syntax for renaming a mysql stored procedure/function? Or is this even supported in MySQL? I've been googling this for several minutes...

like image 360
Ferenc Deak Avatar asked Nov 30 '12 11:11

Ferenc Deak


People also ask

How do I rename a procedure?

To rename a stored procedureExpand Stored Procedures, right-click the procedure to rename, and then click Rename. Modify the procedure name. Modify the procedure name referenced in any dependent objects or scripts.

How do I rename a procedure in MySQL workbench?

So you need to add a parameter and change the code in the stored procedure. Second, right-click the stored procedure that you want to change and select Alter Stored Procedure… MySQL Workbench will open a new tab that contains the definition of the stored procedure. Third, make the changes and click the Apply button.

How do I change a stored procedure in MySQL?

To modify an existing stored routine (procedure or function), double-click the node of the routine to modify, or right-click this node and choose the Alter Routine command from the context menu. Either of the commands opens the SQL Editor. Routine properties can be viewed in the Properties window.


1 Answers

try this

 UPDATE `mysql`.`proc`
SET name = '<new_proc_name>',
specific_name = '<new_proc_name>'
WHERE db = '<database>' AND
  name = '<old_proc_name>';

Also note: If have granted privileges to users for this procedure you will need to update the procedure name in procs_priv as well.

UPDATE `mysql`.`procs_priv`
SET Routine_name = '<new_proc_name>'
WHERE Db = '<database>' AND
  Routine_name = '<old_proc_name>';
 FLUSH PRIVILEGES;

Source: MySQL Forums :: Newbie :: Rename Stored Procedure Syntax

like image 194
SRIRAM Avatar answered Oct 18 '22 22:10

SRIRAM