Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    276

    Unanswered: cursors and bulk collect

    I have a proc like this --

    proc abd()
    is

    cursor r1 is
    select a, b, c, d, e, f
    from
    (select a, b, c, d from v_view
    where d<sysdate
    );

    TYPE rec_tab is table of r1%rowtype;
    v_abc_rec_tab rec_tab;

    begin

    open r1;
    loop

    fetch r1 bulk collect into v_abc_rec_tab
    limit bulk_limit;

    begin

    forall i in 1 .. v_abc_rec_tab.count
    insert into call_table
    values v_abc_rec_tab (i);
    exception
    .......

    end;
    exit when r1%notfound;
    end loop;
    close r1;

    commit;
    end;
    where call_table has fields a, b, c, d as in the view v_view


    It throws an error in the second begin loop saying 'not enough vlaues'
    and
    the cursor r1 saying e is an invalid identifier.
    select a, b, c, d, e, f
    from
    (select a, b, c, d from v_view
    where d<sysdate);


    Should the values in the first select in the cursor be same as the second select? Can someone please give me some idea?
    Last edited by nandinir; 05-21-09 at 17:41.

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    What do you map "e" and "f" to?
    Code:
    select   a, b, c, d, e, f
    from     |  |  |  |  |  |
     (select a, b, c, d  ?  ?
      from v_view
      where d < sysdate
     );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •