Re: ROWNUM. can anybody clarify this to me.

From: David C O Comley <74074.1573_at_compuserve.com>
Date: 1995/08/30
Message-ID: <DE4qJ6.n1C_at_corsair.daytonoh.attgis.com>#1/1


==========Singapore Airlines Ltd, 8/30/95========== 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.

ROWNUM is a pseudo-column which is tacked onto each row returned by a query, so all the rows which satisfy your WHERE clause will get a rownum as they are returned. Thus the query should look for all rows which satisfy the WHERE and then return only the first one found. However, ROWNUMs are affected by the ORDER BY clause because they are assigned before the ORDER BY is applied, so this could give you some unexpected results.

I believe your query would indicate the presence of one or more rows which satisfy the where condition.

Hope this helps.

Dave Comley Received on Wed Aug 30 1995 - 00:00:00 CEST

Original text of this message