V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Fankinl
V2EX  ›  Oracle

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

  •  
  •   Fankinl · Mar 29, 2020 · 2438 views
    This topic created in 2229 days ago, the information mentioned may be changed or developed.

    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 replies    2020-03-29 17:19:05 +08:00
    Fankinl
        1
    Fankinl  
    OP
       Mar 29, 2020
    编辑的时候还能换行,已发布帖子就没有换行了?囧囧囧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3766 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 04:50 · PVG 12:50 · LAX 21:50 · JFK 00:50
    ♥ Do have faith in what you're doing.