Stored Routine Metadata •The  ALTER ROUTINE  privilege is needed to alter or drop stored routines. This privilege is granted automatically to the creator of a routine if necessary, and dropped from the creator when the routine is dropped. •The  EXECUTE  privilege is required to execute stored routines. However, this privilege is granted automatically to the creator of a routine if necessary (and dropped from the creator when the routine is dropped). Also, the default  SQL SECURITY  characteristic for a routine is  DEFINER , which enables users who have access to the database with which the routine is associated to execute the routine. •If the  automatic_sp_privileges  system variable is 0, the  EXECUTE  and  ALTER ROUTINE  privileges are not automatically granted to and dropped from the routine creator. •The creator of a routine is the account used to execute the  CREATE  statement for it. This might not be the same as the account named as the  DEFINER  in the routine definition. •The account named as a routine  DEFINER  can see all routine properties, including its definition. The account thus has full access to the routine output as produced by: •The contents of the  INFORMATION_SCHEMA.ROUTINES  table. •The  SHOW CREATE FUNCTION  and  SHOW CREATE PROCEDURE  statements. •The  SHOW FUNCTION CODE  and  SHOW PROCEDURE CODE  statements. •The  SHOW FUNCTION STATUS  and  SHOW PROCEDURE STATUS  statements. •For an account other than the account named as the routine  DEFINER , access to routine properties depends on the privileges granted to the account: •With the  SHOW_ROUTINE  privilege or the global  SELECT  privilege, the account can see all routine properties, including its definition. •With the  CREATE ROUTINE ,  ALTER ROUTINE  or  EXECUTE  privilege granted at a scope that includes the routine, the account can see all routine properties except its definition. •Query the  ROUTINES  table of the  INFORMATION_SCHEMA  database. See Section 26.3.30, “The INFORMATION_SCHEMA ROUTINES Table” . •Use the  SHOW CREATE PROCEDURE  and  SHOW CREATE FUNCTION  statements to see routine definitions. See Section 13.7.7.9, “SHOW CREATE PROCEDURE Statement” . •Use the  SHOW PROCEDURE STATUS  and  SHOW FUNCTION STATUS  statements to see routine characteristics. See Section 13.7.7.28, “SHOW PROCEDURE STATUS Statement” . •Use the  SHOW PROCEDURE CODE  and  SHOW FUNCTION CODE  statements to see a representation of the internal implementation of the routine. See Section 13.7.7.27, “SHOW PROCEDURE CODE Statement” . 25.2.3 Stored Routine Metadata To obtain metadata about stored routines: Within the body of a stored routine (procedure or function) or a trigger, the value of  LAST_INSERT_ID() changes the same way as for statements executed outside the body of these kinds of objects (see 25.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID() 4731