Results 1 to 2 of 2

Thread: cursor?

  1. #1
    Join Date
    May 2003

    Question Unanswered: cursor?

    is it possible to do this???

    have a cursor defined.

    in the loop

    have select statement. returning multiple rows .

    then insert statement these mutiple rows.

    end loop

    cursor c1 select c1 where pdate>'12-0ct-2003'

    in the loop

    select c1,c2 from tabname
    where status in('P','S');

    --so this returns multiple rows

    --then insert these rows in a single table.

    end loop

    it works fine if i give status = 'P' but iam not sure whether status in returning multiple rows triggering mutiple insert's work

    any ideas r suggestions..

    should the select inside the loop also b defined as cursor. if so, how do i pass values from one cursor to another

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1
    Do the select and insert in a single step, like this:
    insert into table2 (c1,c2)
    select c1,c2 from tabname
    where status in('P','S');

Posting Permissions

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