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

MySQL游标语法的用法

121次阅读
没有评论

共计 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字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国内精品伊人久久久久av影院 | 一区二区三区久久精品 | asmr福利视频在线播放 | 十八18禁国产精品www | 精品一二三区久久aaa片 | 亚洲人成网站在线播放观看 | 国产69精品久久久久777 | 欧美综合成人 | 免费观看国产网址你懂的 | 成年人视频在线免费观看 | 精品国产一二三区在线影院 | 免费看a级黄色片 | 欧美午夜精品久久久久免费视 | 99pao成人国产永久免费视频 | 亚洲欧美一区二区三区 | 亚洲精品影院 | 国产中文字幕在线播放 | 国产精品区免费视频 | 欧洲黑大粗无码免费 | 国产一区二区三区不卡观 | 国产精品久久九九 | 免费人成在线观看网站 | 欧美激情亚洲激情 | 国产亚洲欧美一区二区 | 又大又硬又爽免费视频 | 日本高清aⅴ毛片免费 | 久久中文字幕一区二区三区 | 香蕉久久ac一区二区三区 | 四虎久久精品国产 | 国产欧美性成人精品午夜 | 人妻久久久一区二区三区 | 人妻激情另类乱人伦人妻 | 欧美日本高清一本二本三本 | 亚洲欧美日韩高清综合678 | 日韩精品亚洲专区在线影视 | 公粗挺进了我的密道在线播放贝壳 | 日韩人妻中文无码一区二区 | 污污网站国产精品白丝袜 | 老司机久久影院 | 国产国拍亚洲精品mv在线观看 | 亚洲高清国产一区二区三区 |