我写出来这样 执行不了,
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE db_test
.total
(IN tablename VARCHAR(45),OUT stotal INT)
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
SELECT COUNT(1) INTO stotal FROM tablename GROUP BY product_id;
END$$
DELIMITER ;
执行:
CALL total('n_z_gift_2016_11_04',@stotal)
错误提示:
Table 'db_test.tablename' doesn't exist