Created
March 17, 2011 11:47
-
-
Save skihero/874195 to your computer and use it in GitHub Desktop.
create stored procedure in mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set the delimiter to // to avoid confusion with the ; in the procedure body | |
delimiter // | |
CREATE PROCEDURE people() | |
BEGIN | |
SELECT user, host, password from mysql.user ; | |
END // | |
# To see the procedures | |
SELECT ROUTINE_NAME | |
FROM INFORMATION_SCHEMA.ROUTINES; | |
# To call the procedure | |
call people () ; | |
CREATE PROCEDURE procedures() BEGIN SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES; END // | |
# I use this to find the DN associated with a login_name | |
CREATE PROCEDURE find_common() | |
BEGIN SELECT enterprise.DN from enterprise, users where enterprise.entr_id = users.entr_id and users.login_name=login_name ; END // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment