关于mysql游标的一个例子
2011-04-11 09:47
447 查看
declare fetchSeqOk boolean; ## define the flag for loop judgement
declare _seqname varchar(50); ## define the varient for store the data
declare _value bigint(20);
declare fetchSeqCursor cursor for select seqname, value from sys_sequence;## define the cursor
declare continue handler for NOT FOUND set fetchSeqOk = true; ## define the continue handler for not found flag
set fetchSeqOk = false;
open fetchSeqCursor;
fetchSeqLoop:Loop
if fetchSeqOk then
leave fetchSeqLoop;
else
fetch cursor into _seqname, _value;
begin
declare fetchSeqOk boolean default 'inner';
declare cursor2 cursor for select .... from ...;## define the cursor
declare continue handler for NOT FOUND set fetchSeqOk = true; ## define the continue handler for not
set fetchSeqOk = false;
open cursor2;
fetchloop2 loop
if fetchSeqOk then
else
end if;
end loop;
close cursor2;
end;
end if;
end Loop;
close fetchSeqCursor;
declare _seqname varchar(50); ## define the varient for store the data
declare _value bigint(20);
declare fetchSeqCursor cursor for select seqname, value from sys_sequence;## define the cursor
declare continue handler for NOT FOUND set fetchSeqOk = true; ## define the continue handler for not found flag
set fetchSeqOk = false;
open fetchSeqCursor;
fetchSeqLoop:Loop
if fetchSeqOk then
leave fetchSeqLoop;
else
fetch cursor into _seqname, _value;
begin
declare fetchSeqOk boolean default 'inner';
declare cursor2 cursor for select .... from ...;## define the cursor
declare continue handler for NOT FOUND set fetchSeqOk = true; ## define the continue handler for not
set fetchSeqOk = false;
open cursor2;
fetchloop2 loop
if fetchSeqOk then
else
end if;
end loop;
close cursor2;
end;
end if;
end Loop;
close fetchSeqCursor;
相关文章推荐
- 【mysql】关于子查询的一个例子
- mysql 一个带游标的存储过程例子
- 【mysql】关于子查询的一个例子
- 关于MSSQL存储过程中使用游标的一个小例子(学习)
- sql关于游标和游标、存储过程结合的一个例子
- 关于mysql内存表的一个帖子(转载)
- 在网上看到的一个关于开闭原则的例子
- 一个关于vector比较的例子~
- C#中关于委托练习的一个例子
- Mysql 关于 order by limit 的一个问题
- Mysql | 创建数据库的一个例子分析
- 一个值得借鉴的游标例子
- 给大家做了一个关于日程的例子,可以参考一下,对进一步学习有所帮助
- PhpMyAdmin的简单安装和一个mysql到Redis迁移的简单例子
- 一个非常实用的关于checkboxtree小例子
- 刚才看到一个关于字符串反转的例子
- 关于java clone的一个例子
- 关于异步IO使用的一个例子
- MySQL一个索引最多有多少个列?真实的测试例子
- 关于委托与事件的一个小例子