SHOW FUNCTION STATUS
语法说明
SHOW FUNCTION STATUS 是用来显示数据库中的所有函数的信息,包括函数名、数据库名、创建时间等等。
SHOW FUNCTION STATUS 命令只显示用户定义的函数,不包括系统函数。
语法结构
1. > SHOW FUNCTION STATUS
2. [LIKE 'pattern' | WHERE expr]
语法说明
LIKE 'pattern' 是可选参数,用于筛选要显示的函数。pattern 是一个模式字符串,可以使用 % 和 _ 通配符。例如,要显示所有以 my_function 开头的函数,可以使用以下命令:
1. SHOW FUNCTION STATUS LIKE 'my_function%';
输出结果将包括函数名、数据库名、类型、创建时间和修改时间等信息。
示例
1. create function twosum (x float, y float) returns float language sql as 'select $1 + $2' ;
2. create function mysumtable(x int) returns int language sql as 'select mysum(test_val, id) from tbl1 where id = $1';
3. create function helloworld () returns int language sql as 'select id from tbl1 limit 1';
5. mysql> show function status;
6. +------+------------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
7. | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation |
8. +------+------------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
9. | aab | twosum | FUNCTION | root | 2023-03-27 06:25:41 | 2023-03-27 06:25:41 | DEFINER | | utf8mb4 | utf8mb4_0900_ai_ci | utf8mb4_0900_ai_ci |
10. | aab | mysumtable | FUNCTION | root | 2023-03-27 06:25:51 | 2023-03-27 06:25:51 | DEFINER | | utf8mb4 | utf8mb4_0900_ai_ci | utf8mb4_0900_ai_ci |
11. | aab | helloworld | FUNCTION | root | 2023-03-27 06:25:58 | 2023-03-27 06:25:58 | DEFINER | | utf8mb4 | utf8mb4_0900_ai_ci | utf8mb4_0900_ai_ci |
12. +------+------------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
13. 3 rows in set (0.00 sec)
15. mysql> show function status like 'two%';
16. +------+--------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
17. | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation |
18. +------+--------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
19. | aab | twosum | FUNCTION | root | 2023-03-27 06:25:41 | 2023-03-27 06:25:41 | DEFINER | | utf8mb4 | utf8mb4_0900_ai_ci | utf8mb4_0900_ai_ci |
20. +------+--------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
21. 1 row in set (0.01 sec)
