日期:2014-05-16  浏览次数:20736 次

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;

?

???

1 楼 flyli815 2011-01-10  
引用