數(shù)據(jù)庫的存儲(chǔ)過程是個(gè)偏門,開發(fā)過程中很少用到岳遥,以下是建立和調(diào)用存儲(chǔ)過程的代碼,僅作遺忘時(shí)回憶所用
CREATE PROCEDURE mypro(in p1 INT,INOUT p2 INT,OUT p3 INT)
BEGIN
SELECT p1,p2,p3; -- 輸出p1,p2,p3的內(nèi)容
SET p1 = 10;
SET p2 = 20;
SET p3 = 30;
END
SET @a = 100;
SET @b = 200;
SET @c = 300;
CALL mypro(@a,@b,@c);
SELECT @a,@b,@c; -- 結(jié)果 @q = 100 @b ==20 @c = 30