Get Stored Proc Schema name in mysql
I would like to get the schema name string of a stored proc inside the stored proc itself. I开发者_高级运维 don't know if it's possible because I didn't find any information about it.
Exemple :
DELIMITER $$
DROP PROCEDURE IF EXISTS `exemple` $$
CREATE DEFINER=`root`@`%` PROCEDURE `exemple`()
BEGIN
DECLARE schema_name VARCHAR(100) DEFAULT NULL;
SELECT GET_STORED_PROC_SCHEMA_NAME FROM STORED_PROC_INFO INTO schema_name;
END $$
DELIMITER ;
Thank you
It's easy to do that, use the DATABASE() function.
精彩评论