Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to move cursor to skip couple of record.

Re: How to move cursor to skip couple of record.

From: <pablo1999_at_my-dejanews.com>
Date: Fri, 14 May 1999 20:34:53 GMT
Message-ID: <7hi1dd$o1c$1@nnrp1.deja.com>


I have the same question and your answer didn't help me because:

  1. When v_counter <> 1 I get an empty resultset.
  2. What if my query has an "order by somefield"? Even with v_counter = 1, it doesn't returns the first 10 rows of the whole query.

Oracle's SQL Reference says this about 1) :

Note that conditions testing for ROWNUM values greater than a positive integer are always false. For example, this query returns no rows:

SELECT * FROM emp WHERE ROWNUM > 1;

Thanks.

In article <373a89fb.0_at_145.227.194.253>,   "Mark Gumbs" <mgumbs--AT--hotmail.com> wrote:
> You may have to keep a counter in your application on what records
you want
>
> e.g in your application, counter = 20
>
> cursor c_data(v_counter in number) is
> select empno, ename
> from emp
> where rownum >= v_counter
> and rownum < v_counter + 10;
>
> You then call the cursor in your application with a parameter of
counter
> .....for records in c_data(counter)...
>
> HTH
>
> Mark
>
> --------------------------
>
> Peizhong Wu wrote in message <3739DB52.D382C508_at_umich.edu>...
> >What I am trying to do is to implement a web application. Say,
client can
> get a
> >
> >page of 10 rows, then he can press the "Previous 10" or "Next 10"
button to
> get
> >
> >more.
> >
> >I do not know how people do this.
> >
> >Thanks
> >
> >Jerry Gitomer wrote:
> >
> >> Hi,
> >>
> >> You can, but you shouldn't. Oracle does not store data in a
> predictable
> >> sequence. If you are inserting a new row into a table it may be
inserted
> >> anywhere. As a result you have no way of knowing what the 10th
row in
> the
> >> table contains. If you have already retrieved the 10th row in the
table
> and
> >> you know you will want to access again just save the unique key or
the
> rowid
> >> of the row and use one or the other when you want to access that
same row
> in
> >> the future.
> >>
> >> regards
> >>
> >> Jerry Gitomer
> >>
> >> Peizhong Wu wrote in message <3739C2C5.31D7B844_at_umich.edu>...
> >> >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 Fri May 14 1999 - 15:34:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US