复制代码 代码如下:
fetchSeqLoop:Loop
fetch cursor into _seqname, _value;
end Loop;
复制代码 代码如下:
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;
select _seqname, _value;
end if;
end Loop;
close fetchSeqCursor;
复制代码 代码如下:
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 n
ot
set fetchSeqOk = false;
open cursor2;
fetchloop2 loop
if fetchSeqOk then
else
end if;
end loop;
close cursor2;
end;
end if;
end Loop;
close fetchSeqCursor;
新闻热点
疑难解答