Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    4

    Unhappy Unanswered: How to Fetch Set of records from Open Cursor

    Hi Guys

    I want to fetch specific set of records from the open cursor.
    For Eg:
    - My select statement returns 100 records
    - I want to fetch only 50 to 60 records dynamically from the open cursor, something like fetch_range(50,60).

    Is it possible to fetch range of records from the cursor. If Yes, What is the syntax.

    Thanks
    Ramesh

  2. #2
    Join Date
    May 2004
    Location
    BA [ARG]
    Posts
    137
    That depends on the condition.

    If you want to get 50 of the 60 records no-matter what condition, just to get a 50 sample in the order the records were inserted, you can easly create the cursor like the following:

    Code:
    select * from scott.emp
     where rownum <= 10
    Here I'm getting 10 of the 14 records that exist on the table emp.

    Please, try to be more specific.

    Saludos,
    DKG.

  3. #3
    Join Date
    Oct 2005
    Posts
    4
    In my select statement I have a column called priority_num the value ranges from 1 to 50. I have to display the data based on Priority_num in asc order. When I use rownum to restrict the return rows
    WHERE rownum>=50 and rownum<=60 ORDER BY priority_num
    query returning exactly 10 rows but not in priority_num order.

    So instead of using ROWNUM, I want to prepare my select statement ORDER BY priority_num, empno.

    Thanks

  4. #4
    Join Date
    Oct 2002
    Location
    greenwich.ct.us
    Posts
    279

Posting Permissions

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