mysql存储过程能动态定义光标吗?解决方法

mysql存储过程能动态定义光标吗?

create procedure repairChild(in uid int, in type_get char(6))

begin

declare userCusor cursor for select uid from by_users……

if uid = 0 then

……

else

……

end if;

end

我需要根据传进来的uid生成userCusor光标,可是mysql declare语句必须放在开头,有什么办法实现吗?



对 只能放在开头

有什么需求必须放在后面吗




不可以动态定义,但可以使用变量。这个变量会跟着变化。 关闭然后再OPEN一下就行。




不能动态定义的,但可使用变量。

变量会随着变化的。




不能动态定义游标,间接方法

declare userCusor cursor for select uid from lsb

….

create table lsb as select * from by_users where id=uid

…..

mysql存储过程能动态定义光标吗?解决方法

相关文章:

你感兴趣的文章:

标签云: