存储过程模版
DELIMITER //
DROP PROCEDURE IF EXISTS MyProc;
CREATE DEFINER = 'admin'@'localhost'
PROCEDURE MyProc () SQL SECURITY INVOKER
BEGIN
SELECT 'Number of accounts:', COUNT(*) FROM mysql.user;
END
//
DELIMITER ;
执行存储过程:
CALL Pro_Employee(101,@pcount); #@pcount是一个输出的变量
SELECT @pcount;