mysql存储过程参数问题
发布网友
发布时间:2022-04-22 00:14
我来回答
共1个回答
热心网友
时间:2022-05-05 03:32
改成下面这样
DELIMITER $$
CREATE PROCEDURE proc3 (IN t_name VARCHAR(40))
BEGIN
DECLARE v_sql VARCHAR(500);
SET v_sql= CONCAT('select * from ',t_name);
SELECT v_sql;
SET @v_sql=v_sql;
PREPARE stmt FROM @v_sql;
EXECUTE stmt ;
DEALLOCATE PREPARE stmt;
END $$
DELIMITER ;