CALL Statement调用存储过程
CALL sp_name([parameter[,...]])
CALL sp_name[()]
CREATE PROCEDURE p (OUT ver_param VARCHAR(25), INOUT incr_param INT) BEGIN # Set value of OUT parameter SELECT VERSION() INTO ver_param; # Increment value of INOUT parameter SET incr_param = incr_param + 1; END;
mysql> SET @increment = 10; mysql> CALL p(@version, @increment); mysql> SELECT @version, @increment; +------------------+------------+ | @version | @increment | +------------------+------------+ | 5.7.20-debug-log | 11 | +------------------+------------+
mysql> SET @increment = 10; mysql> PREPARE s FROM 'CALL p(?, ?)'; mysql> EXECUTE s USING @version, @increment; mysql> SELECT @version, @increment; +------------------+------------+ | @version | @increment | +------------------+------------+ | 5.7.20-debug-log | 11 | +------------------+------------+