在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

MySQL游标语法的用法

138次阅读
没有评论

共计 1635 个字符,预计需要花费 5 分钟才能阅读完成。

本篇内容主要讲解“MySQL 游标语法的用法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让丸趣 TV 小编来带大家学习“MySQL 游标语法的用法”吧!

1、基本语法:
Sql 代码
#定义游标
declare fetchSeqCursor cursor for select seqname, value from sys_sequence;
#使用游标
open fetchSeqCursor;
#fetch 数据
fetch cursor into _seqname, _value;
#关闭游标
close fetchSeqCursor;
2、单游标例子:
Sql 代码
## define the flag for loop judgement
declare fetchSeqOk boolean;
## define the varient for store the data
declare _seqname varchar(50);
declare _value bigint(20);
## define the cursor
declare fetchSeqCursor cursor for select seqname, value from sys_sequence;
## define the continue handler for not found flag
declare continue handler for NOT FOUND set fetchSeqOk = true;
set fetchSeqOk = false;
open fetchSeqCursor;
fetchSeqLoop:Loop
if fetchSeqOk then
leave fetchSeqLoop;
else
fetch cursor into _seqname, _value;
select _seqname, _value;
end if;
end Loop;
close fetchSeqCursor;
3、嵌套的游标循环
Java 代码
## define the flag for loop judgement
declare fetchSeqOk boolean;
## define the varient for store the data
declare _seqname varchar(50);
declare _value bigint(20);
## define the cursor
declare fetchSeqCursor cursor for select seqname, value from sys_sequence;
## define the continue handler for not found flag
declare continue handler for NOT FOUND set fetchSeqOk = true;
set fetchSeqOk = false;
open fetchSeqCursor;
fetchSeqLoop:Loop
if fetchSeqOk then
leave fetchSeqLoop;
else
fetch cursor into _seqname, _value;
#嵌套的游标循环
begin
declare fetchSeqOk boolean default inner
## define the cursor
declare cursor2 cursor for select …. from …;
## define the continue handler for not
declare continue handler for NOT FOUND set fetchSeqOk = true;
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 游标语法的用法”有了更深的了解,不妨来实际操作一番吧!这里是丸趣 TV 网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-01发表,共计1635字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国产精品尤物 | 亚洲精品视频专区 | 极品久久 | 久久爰www免费人成 久久曰 | 国产精品欧美日韩精品 | 成人午夜视频一区二区国语 | 四虎免费网站 | 国产精品综合 | 色国产精品一区在线观看 | 艳z门照片无码av | 四虎影院观看视频在线观看 | 亚洲午夜久久久精品影院 | 中国毛片网 | 澳门永久av免费网站 | 亚洲精品无码专区 | 久久国内精品视频 | 欧美一级做a爰片久毛片 | 99色网站| 精品一区二区三区五区六区 | 亚洲精品一二三 | 在线观看一级片 | 99视频精品免视3 | 高清一级毛片免免费看 | 成人看免费一级毛片 | 国产精品欧美一区二区 | 精品欧美一区二区三区在线 | 大又大又粗又硬又爽少妇毛片 | 日韩一级片在线 | 亚洲色欲色欲www | 日韩好片一区二区在线看 | 久久成人永久免费播放 | 亚洲爱婷婷色婷婷五月 | 午夜美女福利视频 | 伊人色综合久久天天小片 | 丰满少妇aaaaaa爰片毛片 | 99热这里只有精品免费 | 色77久久综合网 | 欧美激情视频一区二区 | 人妻少妇久久中文字幕一区二区 | 秋霞影视伦理手机在线观看 | 日韩人妻高清精品专区 |