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: How would you retrieve the first five records

Re: How would you retrieve the first five records

From: Richard Murphy <rmurphy_at_lbpc.com>
Date: Mon, 29 Mar 1999 22:41:07 GMT
Message-ID: <370001F2.99137897@lbpc.com>


I do not think you will be able to do all that you request. The first part is simple.
select *
from table_name
where col_name like '%dollar%'
 and rownum < 6

Beyond that i think you are out of luck. SQL only knows about the records it retrieves. The order in which Oracle retrieves these rows is dependent upon the table indexes and /or table data, so i am not sure what you might mean by the 'next' record. Also, what do you mean by the record number? Are you looking for a column in the table or the actual Oracle rowid?

taratatata_at_my-dejanews.com wrote:

> I am new to sql, I want to retrieve the first five records that
> satisfy a condition and get the last record number checked by
> sql.
>
> Let's say I have 10000 records, some 5000 records includes the string
> "dollar", but I need to retrive only the first five records that include
> this string, and I want to get the record number of the first record
> that comes immediatly after the fifth retrieved record.
>
> I check the syntax of "select" but it does not have a way to get my results,
> any help would be very much appreciated.
>
> Thanks everybody.
> Susan
> Toronto, Canada
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Mon Mar 29 1999 - 16:41:07 CST

Original text of this message

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