如何在 MySQL 中编辑存储过程?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2559997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:41:28  来源:igfitidea点击:

How do you edit a stored procedure in MySQL?

mysqlstored-procedures

提问by Eric Wilson

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

我似乎找不到在 MySQL 中编辑已经创建的存储过程的语法。

回答by Neil Aitken

You can change certain attributes using the ALTER PROCEDUREsyntax

您可以使用ALTER PROCEDURE语法更改某些属性

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

要更改程序主体,您必须删除并重新创建整个程序,在这种情况下,显示创建程序可能很有用

回答by Sagiv Ofek

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

Mysql 不允许更改存储过程,但可以删除 SP 并在 Mysql 中重新创建 SP 选项,如下面的查询

DROP PROCEDURE IF EXISTS foo;
    delimiter //
    create PROCEDURE foo (args)
    begin
      bla bla
    end//
    delimiter ;