DROP {PROCEDURE | FUNCTION} [IF EXISTS] sp_name
These statements are used to drop a stored routine (a stored procedure or function). 这些语句用于删除存储例程(存储过程或函数)。That is, the specified routine is removed from the server. 也就是说,指定的例程将从服务器中删除。((DROP FUNCTION
is also used to drop loadable functions; see Section 13.7.4.2, “DROP FUNCTION Statement for Loadable Functions”.)DROP FUNCTION
也用于删除可加载函数;请参阅第13.7.4.2节,“可加载函数的DROP函数语句”。)
To drop a stored routine, you must have the 要删除存储的例程,您必须具有该例程的ALTER ROUTINE
privilege for it. ALTER ROUTION
权限。(If the (如果启用了automatic_sp_privileges
system variable is enabled, that privilege and EXECUTE
are granted automatically to the routine creator when the routine is created and dropped from the creator when the routine is dropped. automatic_sp_privileges
系统变量,则在创建例程时会自动将该权限和EXECUTE
授予例程创建者,并在删除例程时从创建者处删除该权限和执行。See Section 25.2.2, “Stored Routines and MySQL Privileges”.)请参阅第25.2.2节,“存储例程和MySQL权限”。)
The IF EXISTS
clause is a MySQL extension. IF EXISTS
子句是MySQL扩展。It prevents an error from occurring if the procedure or function does not exist. 如果程序或函数不存在,它可以防止发生错误。A warning is produced that can be viewed with 将生成一个警告,可通过SHOW WARNINGS
.SHOW WARNINGS
进行查看。
DROP FUNCTION
is also used to drop loadable functions (see Section 13.7.4.2, “DROP FUNCTION Statement for Loadable Functions”).DROP FUNCTION
还用于删除可加载函数(请参阅第13.7.4.2节,“可加载函数的DROP函数语句”)。