ALTER PROCEDURE proc_name [characteristic ...]
characteristic: {
COMMENT 'string'
| LANGUAGE {SQL | JAVASCRIPT}
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| USING([library_reference][, library_reference][, ...])
}
This statement can be used to change the characteristics of a
stored procedure. More than one change may be specified in an
ALTER PROCEDURE statement. However,
you cannot change the parameters or body of a stored procedure
using this statement; to make such changes, you must drop and
re-create the procedure using DROP
PROCEDURE and CREATE
PROCEDURE.
You must have the ALTER ROUTINE
privilege for the procedure. By default, that privilege is granted
automatically to the procedure creator. This behavior can be
changed by disabling the
automatic_sp_privileges system
variable. See Section 27.2.2, βStored Routines and MySQL Privilegesβ.
The USING clause is specific to stored programs
written in JavaScript (see Section 27.3, βJavaScript Stored Programsβ),
and allows you to specify a list of zero or more libraries to be
imported by the stored procedure, causing any previous such list
to be removed (just as it does with ALTER
FUNCTION). Possible results are listed here:
A
USINGclause is employed, and lists one or more libraries: Following execution of theALTER PROCEDUREstatement, the procedure imports only those libraries listed in theALTER FUNCTIONstatement; any libraries listed previously are removed from the list and no longer imported.The statement includes an empty
USINGclause: All libraries previously imported are removed from the list; the function no longer imports any libraries.USINGis not used: No changes are made to the list of libraries specified when the procedure was created.
Examples:
ALTER PROCEDURE myproc USING(lib1, lib2);(
USINGwith a non-empty list:) Following execution,myprocimports only the librarieslib1andlib2, and no other libraries.ALTER PROCEDURE myproc USING();(
USINGwith an empty list:) Following execution,myprocno longer imports any libraries at all.ALTER PROCEDURE myproc COMMENT "This procedure was altered";(No
USINGclause:) The procedure continues to import the same libraries as it did before this was issued.