Re: ROWNUM. can anybody clarify this to me.

From: Lawrence James <james.lawrence_at_epamail.epa.gov>
Date: 1995/09/05
Message-ID: <james.lawrence.103.000AF0DC_at_epamail.epa.gov>#1/1


In article <421tln$pq0_at_cardinal.fs.com> skannan_at_cardinal.fs.com ( S. Kannan) writes:
>From: skannan_at_cardinal.fs.com ( S. Kannan)
>Subject: Re: ROWNUM. can anybody clarify this to me.
>Date: 30 Aug 1995 14:47:19 GMT
 

>Singapore Airlines Ltd (engsys_at_merlion.singnet.com.sg) wrote:
>: HI,
 

>: I have some basic doubts with the usage of ROWNUM.
 

>: I generally used to append a condition
>: WHERE rownum = 1
>: for the SQL statements that check for the existence of a record.
 

>: Does this stmt get all the records that satisfy the condition before
>: rownum = 1 and then use this condition or
>: the first instance itself it gets only one record ?
 

>: Thanks for clarifying this to me.
 

>: laxmi.

>Hi Laxmi,
 

>A Rownum = 1 condition will scan all rows and then return the first row.
>Rownums are assigned only at row retrieval. (And before the rows are
>ordered)

I don't think this is true anymore. Looks like my server is not scanning all the rows before returning the first one on a where rownum = 1. I know Oracle used to do that. Related to that it is not scanning all rows on a query with literal comparisons anymore either, IE where 1 = 2. I use that occasionally to create a copy of a table without data. Create table a as select * from b where 1=2.

Lawrence....

>Hope this answers your question.
 

>--
>---------------------------------------------------------------------------
>Kannan
>Email: skannan_at_fs.com
>Mastech Systems Corporation
 

>The above are my own comments and opinion. They do not purport that of
>anybody else.
>---------------------------------------------------------------------------
Received on Tue Sep 05 1995 - 00:00:00 CEST

Original text of this message