Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropping procedure which already exists? [duplicate]

Possible Duplicate:
Error with mysql procedures ERROR 1304 & ERROR 1305

I try to run a command to drop a procedure:

DROP PROCEDURE create_datetable 

By doing this I get the a warning:

1304 PROCEDURE create_datetable already exists 

After that when I'm trying to create a new procedure with the same name, I get the same warning.

What does this mean?

like image 458
MikkoP Avatar asked Jan 01 '13 11:01

MikkoP


People also ask

How do you drop a procedure if exists?

DROP PROCEDURE removes the definition of one or more existing procedures. To execute this command the user must be the owner of the procedure(s). The argument types to the procedure(s) usually must be specified, since several different procedures can exist with the same name and different argument lists.

How do I drop an existing procedure in SQL?

Using SQL Server Management Studio Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure to remove, and then click Delete.

How do I drop a procedure in Oracle?

The syntax to a drop a procedure in Oracle is: DROP PROCEDURE procedure_name; procedure_name. The name of the procedure that you wish to drop.


1 Answers

Reference: Drop Procedure.

The code:

DROP PROCEDURE IF EXISTS procedureName; ... 

Edit:

Can you try to rename the procedure and then try to drop it as per this post: Rename a mysql procedure?

try this:

UPDATE `mysql`.`create_DataTable` 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 newProcedure as well.

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

Do you have the freedom to delete all procedures? If so please try out this post: Drop all stored procedures in MySQL or using temporary stored procedures and post2: Drop all stored procedures in MySQL or using temporary stored procedures.

like image 133
bonCodigo Avatar answered Sep 18 '22 15:09

bonCodigo