views:

20

answers:

1

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

A: 

It's easy to do that, use the DATABASE() function.

Mike