begin

#声明一个游标读取标记
declare done int default 0;
#取关键词记录
declare cur1 dynamic cursor for executeSQL;
#declare cur1 cursor for select keyword,priority from KeyWordSet order by priority;
declare continue handler for not found set done = 1;end
会报错!

解决方案 »

  1.   

    mysql现在还不支持动态游标吧...
      

  2.   

    我只是想知道MySQL到底支不支持动态游标,不支持的话,另想办法。我想达到的目的是可以用游标来执行动态SQL!
      

  3.   


    执行动态SQL,可以用预处理语句来操作呀。mysql> SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
    mysql> PREPARE stmt2 FROM @s;
    mysql> SET @a = 6;
    mysql> SET @b = 8;
    mysql> EXECUTE stmt2 USING @a, @b;
    +------------+
    | hypotenuse |
    +------------+
    |         10 |
    +------------+
    mysql> DEALLOCATE PREPARE stmt2;手册上的例子,你看看那。
      

  4.   

    用循环代替吧, MYSQL暂时不支持!
      

  5.   

    不支持,可以用
    游标:
    select * from tt
    用动态语句生成TT表