小白请教各位大神 Oracle 里 循环游标 Cursor_1 时里边再循环一个游标 Cursor_2,发现 Cursor_2 里的数据不对

2020-03-29 17:18:14 +08:00
 Fankinl

v_count number; A number; B number; C number;

A:=1; B:=1; C:=1;

cursor Cursor_2(A number, B number, C number) is select * from table1 tt where tt.A = A and tt.B = B and tt.C = C;

for cur_1 in Cursor_1 loop select count(1) into v_count from table1 tt where tt.A = A and tt.B = B and tt.C = C; if(v_count > 0 ) then for cur_2 in Cursor_2(A, B, C) loop -- ToDo end loop; end if; end loop;

--- 以上是简单的一段类似 Sql ---

其中我断点看过 v_count == 1, 但是在第二个循环里头断点发现循环了两遍,Cursor2 游标的数据好像跟传入参数所查询出来的不一样,这个不太很明白情况 有没有大神可以指导一下呢?

1685 次点击
所在节点    Oracle
1 条回复
Fankinl
2020-03-29 17:19:05 +08:00
编辑的时候还能换行,已发布帖子就没有换行了?囧囧囧

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/657309

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX