'Execute'mysql中有多个查询

时间:2014-01-20 08:11:52

标签: mysql sql

这是我的简单sp执行两个查询,但MySQL不能允许它, 是不是两种方式在MySQL中动态执行多个查询

CREATE DEFINER=`test`@`%` PROCEDURE `usp_test.test`()
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
  BEGIN
   Rollback; 
    resignal;
  END;

start transaction;
set @dynamicquery='
select Now();
select NOW();
';
PREPARE stmt1 FROM @dynamicquery;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1; 
commit;
END

0 个答案:

没有答案