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

Home -> Community -> Usenet -> c.d.o.server -> Re: to sqlplus expert. - is this sqlplus version problem?

Re: to sqlplus expert. - is this sqlplus version problem?

From: <fitzjarrell_at_cox.net>
Date: 14 Oct 2005 08:02:27 -0700
Message-ID: <1129302147.839234.131950@f14g2000cwb.googlegroups.com>


Comments embedded.
jdyang wrote:
> Hello. I'm newbie of sqlplus.
>
> I use sql plus 8.1.5.0.0.
>

Not the best version to use if you have a choice.

> I want to get row between 3 to 5. like,
>

For what purpose?

> select * from table where rownum >= 3 and rownum =< 5;
>
> and when I use above query, there is no record.
>
> I found reason from google that rownum is attached to row when that row
> pass the where condition.

Correct, and you have to assign a 1 before you can get to 3, and you haven't done so.

> And from another webpage, I found the message that those query are
> working well.
>

You apparently misread the webpage, as that query will NEVER return results. Ever.

> how I can get row between 3 to 5. Above query is just version problem?
>
> Infact, I'm using temporary query:
> select * from
> ( select <column names>, rownum as temp_rownum where <table> )
> where temp_rownum >= 3 and temp_rownum <=5;
>

That won't work, either. This should:

select t.*
from (select rownum r, table.* from table) t where t.r between 3 and 5;

I am still lost as to the reason you need this.

>
> and surely, I'm not satisfied.
>
> Can you help me please? - to sql experts.

David Fitzjarrell Received on Fri Oct 14 2005 - 10:02:27 CDT

Original text of this message

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