Truy vấn bảng hệ thống mysql.proc để xem danh sách function kèm toàn bộ metadata:
mysql> SELECT * FROM mysql.proc WHERE db = 'query' AND type = 'FUNCTION' \G
*************************** 1. row ***************************
db: query
name: factorial
type: FUNCTION
specific_name: factorial
language: SQL
sql_data_access: CONTAINS_SQL
is_deterministic: YES
security_type: DEFINER
param_list: n DECIMAL(3,0)
returns: decimal(20,0)
body: BEGIN DECLARE factorial DECIMAL(20,0) DEFAULT 1; DECLARE counter DECIMAL(3,0); SET counter = n; factorial_loop: REPEAT SET factorial = factorial * counter; SET counter = counter - 1; UNTIL counter = 1 END REPEAT; RETURN factorial; END
definer: root@localhost
created: 2021-11-16 14:04:48
modified: 2021-11-16 14:04:48
sql_mode: ...
comment:
character_set_client: cp850
collation_connection: cp850_general_ci
db_collation: latin1_swedish_ci
body_utf8: ...
*************************** 2. row ***************************
db: query
name: Hello
type: FUNCTION
...
body: RETURN CONCAT('Hello, ',s,'!')
...
Bao gồm: tên, tham số, kiểu trả về, body code, definer, thời gian tạo/sửa, sql_mode, charset, collation...