Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you edit a stored procedure in MySQL? [closed]

I can't seem to find the syntax for editing an already-created stored procedure in MySQL.

like image 279
Eric Wilson Avatar asked Apr 01 '10 11:04

Eric Wilson


People also ask

How do I edit 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.

How do I edit a stored procedure?

Use 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 modify, and then select Modify. Modify the text of the stored procedure. To test the syntax, on the Query menu, select Parse.

How do you update a stored procedure in SQL?

To write Update stored procedure, follow the same procedure, simply write UPDATE sql statement inside the stored procedure. Notice the above stored procedure code, this is almost similar to the Insert stored procedure.

How do I open a stored procedure in MySQL?

Create a simple stored procedure. DELIMITER ; To create the MySQL Stored Procedure, open the MySQL workbench Connect to the MySQL Database copy-paste the code in the query editor window click on Execute. You can view the procedure under stored procedures.


2 Answers

You can change certain attributes using the ALTER PROCEDURE syntax

To change the procedure body you will have to drop and recreate the entire procedure, in this case SHOW CREATE PROCEDURE may be useful

like image 119
Neil Aitken Avatar answered Oct 01 '22 05:10

Neil Aitken


Mysql do not allow to alter stored procedure but SP can be drop and recreate SP options are available in Mysql like below query

DROP PROCEDURE IF EXISTS foo;
    delimiter //
    create PROCEDURE foo (args)
    begin
      bla bla
    end//
    delimiter ;
like image 21
Sagiv Ofek Avatar answered Oct 01 '22 05:10

Sagiv Ofek