Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to move cursor to skip couple of record.
Hey,
it is *NOT* possible to "skip" a record.
You have to ways:
I would recommend b) in order to avoid ORA-01555.
ad b)
All you do is you identify the unique ordering criteria. Lets say the primary key (PK).
The next step is to create a cursor which fetches n records starting with last_PK. when you start last_PK will be NULL. you WHERE clause would look something like WHERE ( (dbpk > last_PK) or (last_PK IS NULL)) and ROWNUM <= n
Be careful when you use compound keys ... there you have to have for every component of the key a different loop.
You open the cursor, fetch your 10 records, populate your columns/fields and store the fetched PK into last_PK, close the cursor and wait for the input.
If the user wants the next 10 records you just re-open the cursor.
With the same technique you can do the previous 10 records.
Using re-openable cursors has the benefit of getting always the newest set of data for the new query.
If you are using Java you might want consider using JBO which provides you with a mechanism of popualting everything automatic.
You might want to check JDeveloper 2.0 which gives you a great deal benefit when using Java against the oracle server.
Regards
Dante
In article <3739C2C5.31D7B844_at_umich.edu>,
Peizhong Wu <wupz_at_umich.edu> wrote:
> HI,
>
> How can I move cursor to #10 record without fetch the first 9 records?
>
> Thanks
>
>
--== Sent via Deja.com http://www.deja.com/ ==-- ---Share what you know. Learn what you don't.--- Received on Mon May 17 1999 - 04:58:36 CDT
![]() |
![]() |