V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Fankinl
V2EX  ›  Oracle

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

  •  
  •   Fankinl · 2020-03-29 17:18:14 +08:00 · 1662 次点击
    这是一个创建于 1461 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 游标的数据好像跟传入参数所查询出来的不一样,这个不太很明白情况 有没有大神可以指导一下呢?

    1 条回复    2020-03-29 17:19:05 +08:00
    Fankinl
        1
    Fankinl  
    OP
       2020-03-29 17:19:05 +08:00
    编辑的时候还能换行,已发布帖子就没有换行了?囧囧囧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2810 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 14:52 · PVG 22:52 · LAX 07:52 · JFK 10:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.