USE `test_csv`; --test_csv is the table name
DROP procedure IF EXISTS `new_procedure`;
DELIMITER $$ --change delimiter
USE `test_csv`$$
CREATE DEFINER=`test_code`@`%` PROCEDURE `new_procedure`(OUT count INT)
BEGIN
select count(*) into count from minutes_data;
END$$
DELIMITER ; --change back delimiter
调用存储过程:
传参数说明:
如果想获得存储过程中OUT或者INOUT参数的值,在调用的时候需要传入用户变量,然后在存储过程执行之后检查变量的值。
call new_procedure(@count); --此处传变量count,获取存储过程的输出值
select @count; -- get the value of the count, where count is the result of the procedure.
存储过程调用时,存储过程中的IN参数可以直接传值,INOUT可以通过变量赋值传入,如果需要获取INOUT或者OUT的值,需要传变量,使用@variable_name的方式传变量。
INOUT使用示例:
USE `test_csv`;
DROP procedure IF E