Mysql
 sql >> Database >  >> RDS >> Mysql

ERRORE quando si invia la tabella come parametro nella procedura del negozio MySQL

Cambia il tuo codice in:

DELIMITER $$
USE `db_test`$$
DROP PROCEDURE IF EXISTS `test_proc`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc`(IN newsInfoTable VARCHAR(100))
BEGIN     
    SET @sql_stam = CONCAT( 'SELECT news INTO @news FROM ',newsInfoTable
                           ,' WHERE DATE(`date_time`) = CURDATE()' );      
    PREPARE s1 FROM @sql_stam;         
    SELECT @news;          
 END$$
DELIMITER ;