mysql 存儲過程

name  age phone
chen 25 134xxxx
zhang   30 158xxxxx

 

 

 

 

 

語法:spa

CREATE PROCEDURE  過程名([[IN|OUT|INOUT] 參數名 數據類型[,[IN|OUT|INOUT] 參數名 數據類型…]]) [特性 ...] 過程體
CREATE PROCEDURE myproc(OUT s int) BEGIN SELECT COUNT(*) INTO s FROM students; END


 

帶IN參數示例code

DROP PROCEDURE IF EXISTS in_param;
DELIMITER //
CREATE PROCEDURE in_param (IN para_in INT)

BEGIN
SELECT * from table1 WHERE age = para_in;
END ;
//DELIMITER #調用
SET @para_in = 25; CALL in_param (@para_in);
相關文章
相關標籤/搜索