MySQL Forums
Forum List  »  Stored Procedures

stored procedure to list stored procedures
Posted by: aufmy
Date: February 01, 2007 01:13PM

Hi, I am a newbie to stored procedures. I would like to created a stored procedure to list all current stored procedures available. Is there a way to call a mysql variable that knows what database I am currently using?

Where 'testspp' is replaced by the database that is currently being used.

Thanks
Audrey

DELIMITER $$
DROP PROCEDURE IF EXISTS list_stored_routines
$$
CREATE PROCEDURE list_stored_routines
(show_body INT)
READS SQL DATA
BEGIN
IF (show_body = 1) THEN
SELECT routine_name, routine_type, definer, routine_definition FROM information_schema.routines WHERE routine_schema LIKE 'testspp';
ELSE
SELECT routine_name, routine_type, definer FROM information_schema.routines WHERE routine_schema LIKE 'testspp';
END IF;

END;
$$
DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
stored procedure to list stored procedures
26076
February 01, 2007 01:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.