Mysql:存储过程中动态SQL返回多个值的写法

DROP PROCEDURE IF EXISTS  TEST;
CREATE PROCEDURE  TEST(IN tableName varchar(255), OUT id bigint)
BEGIN 
    SET @DYNCSQL = CONCAT('SELECT DBID_ , DUEDATE_ into  
           @id_,@date_ FROM ', CAST(tableName as CHAR),' limit 1');
    PREPARE statement FROM @DYNCSQL ;
    EXECUTE statement;
END

CALL TEST('jbpm_demo.JBPM4_JOB',@id);
SELECT @id;

 

   

你可能感兴趣的:(sql,mysql,jbpm)