mysql queries statements for stored procedures and functions in the database
- 2020-05-10 23:01:52
- OfStack
Method 1:
select 'name' mysql. proc where db = 'your_db_name' and 'type' = 'PROCEDURE' // stored procedure
select 'name' mysql. proc where db = 'your_db_name' and 'type' = 'FUNCTION' // function
Method 2:
show procedure status; // stored procedure
SHOW PROCEDURE STATUS WHERE db='servant_591up'
show function status; / / function
View the code for creating a stored procedure or function
show create procedure proc_name;
show create function func_name;
Look at the view
SELECT * from information_schema.VIEWS // view
SELECT * from information_schema. TABLES // table
View trigger
Method 1:
Syntax: SHOW TRIGGERS [FROM db_name] [LIKE expr]
Example: SHOW TRIGGERS\G // flip-flop
Method 2:
Query the TRIGGERS table in the INFORMATION_SCHEMA database
mysql > SELECT * FROM triggers T WHERE trigger_name= "mytrigger" \G
select 'name' mysql. proc where db = 'your_db_name' and 'type' = 'PROCEDURE' // stored procedure
select 'name' mysql. proc where db = 'your_db_name' and 'type' = 'FUNCTION' // function
Method 2:
show procedure status; // stored procedure
SHOW PROCEDURE STATUS WHERE db='servant_591up'
show function status; / / function
View the code for creating a stored procedure or function
show create procedure proc_name;
show create function func_name;
Look at the view
SELECT * from information_schema.VIEWS // view
SELECT * from information_schema. TABLES // table
View trigger
Method 1:
Syntax: SHOW TRIGGERS [FROM db_name] [LIKE expr]
Example: SHOW TRIGGERS\G // flip-flop
Method 2:
Query the TRIGGERS table in the INFORMATION_SCHEMA database
mysql > SELECT * FROM triggers T WHERE trigger_name= "mytrigger" \G