CREATE PROCEDURE and CREATE FUNCTION Statements default database. To associate the routine explicitly with a given database, specify the name as db_name.sp_name  when you create it. The  CREATE FUNCTION  statement is also used in MySQL to support loadable functions. See Section 13.7.4.1, “CREATE FUNCTION Statement for Loadable Functions” . A loadable function can be regarded as an external stored function. Stored functions share their namespace with loadable functions. See Section 9.2.5, “Function Name Parsing and Resolution” , for the rules describing how the server interprets references to different kinds of functions. To invoke a stored procedure, use the  CALL  statement (see Section 13.2.1, “CALL Statement” ). To invoke a stored function, refer to it in an expression. The function returns a value during expression evaluation. CREATE PROCEDURE  and  CREATE FUNCTION  require the  CREATE ROUTINE  privilege. If the  DEFINER clause is present, the privileges required depend on the  user  value, as discussed in Section 25.6, “Stored Object Access Control” . If binary logging is enabled,  CREATE FUNCTION  might require the  SUPER privilege, as discussed in Section 25.7, “Stored Program Binary Logging” . By default, MySQL automatically grants the  ALTER ROUTINE  and  EXECUTE  privileges to the routine creator. This behavior can be changed by disabling the  automatic_sp_privileges  system variable. See Section 25.2.2, “Stored Routines and MySQL Privileges” . The  DEFINER  and  SQL SECURITY  clauses specify the security context to be used when checking access privileges at routine execution time, as described later in this section. If the routine name is the same as the name of a built-in SQL function, a syntax error occurs unless you use a space between the name and the following parenthesis when defining the routine or invoking it later. For this reason, avoid using the names of existing SQL functions for your own stored routines. The  IGNORE_SPACE  SQL mode applies to built-in functions, not to stored routines. It is always permissible to have spaces after a stored routine name, regardless of whether  IGNORE_SPACE  is enabled. The parameter list enclosed within parentheses must always be present. If there are no parameters, an empty parameter list of  ()  should be used. Parameter names are not case-sensitive. Each parameter is an  IN  parameter by default. To specify otherwise for a parameter, use the keyword  OUT or  INOUT  before the parameter name. Specifying a parameter as  IN ,  OUT , or  INOUT  is valid only for a  PROCEDURE . For a FUNCTION , parameters are always regarded as  IN  parameters. Note An  IN  parameter passes a value into a procedure. The procedure might modify the value, but the modification is not visible to the caller when the procedure returns. An  OUT  parameter passes a value from the procedure back to the caller. Its initial value is  NULL  within the procedure, and its value is visible to the caller when the procedure returns. An  INOUT  parameter is initialized by the caller, can be modified by the procedure, and any change made by the procedure is visible to the caller when the procedure returns. For each  OUT  or  INOUT  parameter, pass a user-defined variable in the  CALL  statement that invokes the procedure so that you can obtain its value when the procedure returns. If you are calling the procedure from within another stored procedure or function, you can also pass a routine parameter or local routine variable as an  OUT  or  INOUT  parameter. If you are calling the procedure from within a trigger, you can also pass  NEW. col_name  as an  OUT  or  INOUT  parameter. For information about the effect of unhandled conditions on procedure parameters, see Section 13.6.7.8, “Condition Handling and OUT or INOUT Parameters” . 2531