ROUTINES 表提供有关存储例程(存储过程和存储函数)的信息。ROUTINES 表不包括内置(本地)函数或可加载函数。The ROUTINES table provides
information about stored routines (stored procedures and stored
functions). The ROUTINES table does
not include built-in (native) functions or loadable functions.
ROUTINES 表具有以下列:The ROUTINES table has these columns:
SPECIFIC_NAME例程的名称。The name of the routine.
ROUTINE_CATALOG例程所属目录的名称。此值始终为
def。The name of the catalog to which the routine belongs. This value is alwaysdef.ROUTINE_SCHEMA该例程所属的模式(数据库)的名称。The name of the schema (database) to which the routine belongs.
ROUTINE_NAME例程的名称。The name of the routine.
ROUTINE_TYPEPROCEDURE对于存储过程,FUNCTION对于存储函数。PROCEDUREfor stored procedures,FUNCTIONfor stored functions.DATA_TYPE如果例程是存储函数,则为返回值的数据类型。如果例程是存储过程,则此值为空。If the routine is a stored function, the return value data type. If the routine is a stored procedure, this value is empty.
DATA_TYPE的值仅为类型名称,不包含其他信息。DTD_IDENTIFIER的值包含类型名称及可能的其他信息,如精度或长度。TheDATA_TYPEvalue is the type name only with no other information. TheDTD_IDENTIFIERvalue contains the type name and possibly other information such as the precision or length.CHARACTER_MAXIMUM_LENGTH对于存储函数的字符串返回值,最大字符长度。如果该例程是存储过程,则此值为
NULL。For stored function string return values, the maximum length in characters. If the routine is a stored procedure, this value isNULL.CHARACTER_OCTET_LENGTH对于存储函数的字符串返回值,最大字节长度。如果该例程是存储过程,则此值为
NULL。For stored function string return values, the maximum length in bytes. If the routine is a stored procedure, this value isNULL.NUMERIC_PRECISION对于存储函数的数值返回值,数值精度。如果该例程是存储过程,则此值为
NULL。For stored function numeric return values, the numeric precision. If the routine is a stored procedure, this value isNULL.NUMERIC_SCALE对于存储函数的数值返回值,数值标度。如果该例程是存储过程,则此值为
NULL。For stored function numeric return values, the numeric scale. If the routine is a stored procedure, this value isNULL.DATETIME_PRECISION对于存储函数的时间类型返回值,秒的小数精度。如果该例程是存储过程,则此值为
NULL。For stored function temporal return values, the fractional seconds precision. If the routine is a stored procedure, this value isNULL.CHARACTER_SET_NAME对于存储函数的字符返回值,字符集名称。如果例程是存储过程,则该值为
NULL。For stored function character string return values, the character set name. If the routine is a stored procedure, this value isNULL.COLLATION_NAME对于存储函数的字符返回值,排序规则名称。如果例程是存储过程,则该值为
NULL。For stored function character string return values, the collation name. If the routine is a stored procedure, this value isNULL.DTD_IDENTIFIER如果例程是存储函数,则为返回值的数据类型。如果例程是存储过程,则此值为空。If the routine is a stored function, the return value data type. If the routine is a stored procedure, this value is empty.
DATA_TYPE的值仅为类型名称,不包含其他信息。DTD_IDENTIFIER的值包含类型名称及可能的其他信息,如精度或长度。TheDATA_TYPEvalue is the type name only with no other information. TheDTD_IDENTIFIERvalue contains the type name and possibly other information such as the precision or length.ROUTINE_BODY定义例程所使用的语言。该值始终为
SQL。The language used for the routine definition. This value is alwaysSQL.ROUTINE_DEFINITION例程执行的 SQL 语句文本。The text of the SQL statement executed by the routine.
EXTERNAL_NAME该值始终为
NULL。This value is alwaysNULL.EXTERNAL_LANGUAGE存储例程的语言。该值从
mysql.routines数据字典表的external_language列读取。The language of the stored routine. The value is read from theexternal_languagecolumn of themysql.routinesdata dictionary table.PARAMETER_STYLE此值始终为
SQL。This value is alwaysSQL.IS_DETERMINISTICYES或NO,具体取决于例程是否定义了DETERMINISTIC特性。YESorNO, depending on whether the routine is defined with theDETERMINISTICcharacteristic.SQL_DATA_ACCESS例程的数据访问特性。取值为
CONTAINS SQL、NO SQL、READS SQL DATA或MODIFIES SQL DATA之一。The data access characteristic for the routine. The value is one ofCONTAINS SQL,NO SQL,READS SQL DATA, orMODIFIES SQL DATA.SQL_PATH该值始终为
NULL。This value is alwaysNULL.SECURITY_TYPE该例程的
SQL SECURITY特性。其值可以是DEFINER或INVOKER。The routineSQL SECURITYcharacteristic. The value is one ofDEFINERorINVOKER.CREATED例程创建的日期和时间。这是一个
TIMESTAMP值。The date and time when the routine was created. This is aTIMESTAMPvalue.LAST_ALTERED例程最后修改的日期和时间。这是一个
TIMESTAMP值。如果例程自创建以来未被修改,该值与CREATED值相同。The date and time when the routine was last modified. This is aTIMESTAMPvalue. If the routine has not been modified since its creation, this value is the same as theCREATEDvalue.SQL_MODE在创建或修改例程时生效的 SQL 模式,以及例程执行时所用的 SQL 模式。有关允许的值,请参阅第 7.1.11 节,“服务器 SQL 模式”。The SQL mode in effect when the routine was created or altered, and under which the routine executes. For the permitted values, see Section 7.1.11, “Server SQL Modes”.
ROUTINE_COMMENT注释文本,如果例程有注释。如果没有,该值为空。The text of the comment, if the routine has one. If not, this value is empty.
DEFINERDEFINERDEFINER子句中指定的帐户名(通常是创建例程的用户),格式为'。The account named in theuser_name'@'host_name'DEFINERclause (often the user who created the routine), in'format.user_name'@'host_name'CHARACTER_SET_CLIENT创建例程时
character_set_client系统变量的会话值。The session value of thecharacter_set_clientsystem variable when the routine was created.COLLATION_CONNECTION创建例程时,
collation_connection系统变量的会话值。The session value of thecollation_connectionsystem variable when the routine was created.DATABASE_COLLATION与例程关联的数据库的排序规则。The collation of the database with which the routine is associated.
注意Notes
要查看例程的信息,您必须是指定为例程
DEFINER的用户,拥有SHOW_ROUTINE权限,在全局级别拥有SELECT权限,或在涵盖该例程的范围内拥有CREATE ROUTINE、ALTER ROUTINE或EXECUTE权限。如果您仅拥有CREATE ROUTINE、ALTER ROUTINE或EXECUTE,则ROUTINE_DEFINITION列为NULL。To see information about a routine, you must be the user named as the routineDEFINER, have theSHOW_ROUTINEprivilege, have theSELECTprivilege at the global level, or have theCREATE ROUTINE,ALTER ROUTINE, orEXECUTEprivilege granted at a scope that includes the routine. TheROUTINE_DEFINITIONcolumn isNULLif you have onlyCREATE ROUTINE,ALTER ROUTINE, orEXECUTE.关于存储函数返回值的信息也可以在
PARAMETERS表中获得。存储函数的返回值行可以通过ORDINAL_POSITION值为 0 的行来识别。Information about stored function return values is also available in thePARAMETERStable. The return value row for a stored function can be identified as the row that has anORDINAL_POSITIONvalue of 0.