RE: ROWNUM is driving me nuts - queries suggested produced no res

2003-07-09 Thread Mercadante, Thomas F
MaryAnn, the best way to understand rownum is to do the following: SQL SELECT ROWNUM, GENDER 2 FROM (SELECT ROWNUM, GENDER 3 FROM EMP2 4 WHERE ROWNUM = 20) You will quickly see that, no matter how you order the result set, the first record returned is rownum #1,

RE: ROWNUM is driving me nuts - queries suggested produced no res

2003-07-09 Thread Freeman Robert - IL
Only less and = queries with regards to rownum are supported. RF -Original Message- To: Multiple recipients of list ORACLE-L Sent: 7/9/2003 11:19 AM I definitely dont fully understand ROWNUM yet, and you guys so far provided more info than a couple of books by Oracle, that I have

RE: ROWNUM is driving me nuts - queries suggested produced no res

2003-07-09 Thread Freeman Robert - IL
To add on to my previous comments, change your code a bit: SQL SELECT RN, GENDER 2 FROM (SELECT ROWNUM RN, GENDER 3 FROM EMP2 4 WHERE ROWNUM = 20) 5 WHERE RN 10; -Original Message- To: Multiple recipients of list ORACLE-L Sent: 7/9/2003 11:19 AM I

Re: ROWNUM is driving me nuts - queries suggested produced no results

2003-07-09 Thread Daniel Fink
Each row that is retrieved from the database that matches the WHERE condition is placed in a result set. The sequence within the result set is the value in the pseudocolumn ROWNUM. If Oracle is using a full-table scan, the first row of the first block is the first in the result set and is

RE: ROWNUM -- HOW ARE ROWS SELECTED?

2003-07-09 Thread MaryAnn Atkinson
Its obvious I hadnt fully understood ROWNUM yet, as you see we are learning bits and pieces as we go along. Help me out here, will you? Talk to me like I'm a 10-year old, its ok. MaryAnn, the best way to understand rownum is to do the following: SQL SELECT ROWNUM, GENDER 2 FROM

RE: ROWNUM is driving me nuts - queries suggested produced no res

2003-07-09 Thread Rudy Zung
Think of it this way: when Oracle builds a result set, it goes into the table and tries to qualify the records in the table by evaluating the where clause; if the record does not qualify, the record will not appear in the result set, if the record does qualify, then the record will be returned in

RE: ROWNUM - THATS THE ONE!!! THAT DID IT!!!

2003-07-09 Thread MaryAnn Atkinson
THATS THE ONE!!! THAT DID IT!!! --- Freeman Robert - IL [EMAIL PROTECTED] wrote: To add on to my previous comments, change your code a bit: SQL SELECT RN, GENDER 2 FROM (SELECT ROWNUM RN, GENDER 3 FROM EMP2 4 WHERE ROWNUM = 20) 5 WHERE RN 10; The last

RE: ROWNUM is driving me nuts - queries suggested produced no results

2003-07-09 Thread Stephane Faroult
I definitely dont fully understand ROWNUM yet, and you guys so far provided more info than a couple of books by Oracle, that I have here. For a second I thought I'm beginning to get it, but the queries suggested produced no results... SQL SELECT ROWNUM, GENDER 2 FROM (SELECT ROWNUM,

RE: ROWNUM -- HOW ARE ROWS SELECTED?

2003-07-09 Thread Jay Hostetter
Mary Ann, Assume that the rows are selected in random order. Primary Keys and Order By exist for ordering and qualifying your data. If you just select * from EMP2, most likely the rows willl come back in the order that they were inserted, but this is not necessarily true, especially if

RE: ROWNUM -- HOW ARE ROWS SELECTED?

2003-07-09 Thread Rudy Zung
Oracle does not guarantee the order in which records are retrieved (read in from the disk or data buffers) nor does Oracle guarantee the order in which records are presented to you unless you specify an ORDER BY. The ROWNUM is assigned after Oracle has selected the record to appear in the result

RE: ROWNUM - Can the inner-outer idea be extended to an update?

2003-07-09 Thread MaryAnn Atkinson
Can the inner-outer idea be extended to an update? UPDATE EMP2 SETGENDER = 'F' WHERE GENDER = ' ' ANDROWNUM BETWEEN 10 AND 20; That does NOT work, because as we explained the returned rows are numbered starting from 1, and so rownum never really matches a 10 or 20 or anything

Re: ROWNUM - Can the inner-outer idea be extended to an update?

2003-07-09 Thread Daniel Fink
IF you are looking to break up the update into more 'manageable' pieces, here is a thought... UPDATE EMP2 SET GENDER = 'F' WHERE GENDER = ' ' AND ROWNUM = 100; UPDATE EMP2 SET GENDER = 'F' WHERE GENDER = ' ' AND ROWNUM = 100; *Since the first 100 records have already been updated, the second

RE: ROWNUM is driving me nuts - queries suggested produced no res

2003-07-09 Thread Orr, Steve
just what is it you want to return in your query? If the query results are to be displayed a chunk at a time on a web page then you should give strong consideration to using OCI and implementing scrollable cursors with the OCIStmtFetch2() function and its OCI_FETCH_NEXT, OCI_FETCH_PRIOR,

Re: RE: ROWNUM - Can the inner-outer idea be extended to an update?

2003-07-09 Thread rgaffuri
PROTECTED] Date: 2003/07/09 Wed PM 01:34:24 EDT To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] Subject: RE: ROWNUM - Can the inner-outer idea be extended to an update? Can the inner-outer idea be extended to an update? UPDATE EMP2 SETGENDER = 'F' WHERE GENDER

RE: Rownum

2003-03-19 Thread ISI/BDD/HAOUHACH
just do select rownum, col1,col2, from table1 -Message d'origine-De: Santosh Varma [mailto:[EMAIL PROTECTED]Envoyé: mercredi 19 mars 2003 09:44À: Multiple recipients of list ORACLE-LObjet: Rownum Hello list, I wanted to know the concept of Rownum.. Is it

Re: Rownum

2003-03-19 Thread Darrell Landrum
Santosh, Good question. Actually these 2 are not related. Rowid is an actual attribute assigned to each row of a table and is unique. Rownum is logically assigned to rows returned in a query (nothing to do with the table). It is assigned sequentially as rows are returned (meaning if you can't

RE: Rownum

2003-03-19 Thread John Blake
no, rownum is a sequential number whereas rowid is a pointer to the row of the table within the database. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Santosh VarmaSent: Wednesday, March 19, 2003 4:44 AMTo: Multiple recipients of list

Re: Re: Rownum

2003-03-19 Thread
Darrell Landrum,ÄúºÃ£¡ thanx for your explaination. I wonder :whether i can judge the select return. I find the rowNUM is not 0, is right? === 2003-03-19 05:03:00 ÄúÔÚÀ´ÐÅÖÐдµÀ£º=== Santosh, Good question. Actually these 2 are not related. Rowid is an actual attribute

RE: Rownum

2003-03-19 Thread Deshpande, Kirti
No. It is not similar to a rowid. It is just a pseudo sequential number assigned to the rows in the result set (after the result set is prepared) from the query. - Kirti -Original Message- Sent: Wednesday, March 19, 2003 3:44 AM To: Multiple recipients of list ORACLE-L Hello list,

Re: Re: Rownum

2003-03-19 Thread Darrell Landrum
That's correct, there's no rownum of 0. ex. SQL select rownum, username from dba_users; ROWNUM USERNAME -- -- 1 SYS 2 SYSTEM 3 OUTLN 4 OEM_DLAND 5 DBSNMP 6 HR 7 PM 8 DLANDRUM 9

RE: Rownum

2003-03-19 Thread Santosh Varma
Thanks to all who replied to me. Now it is clear.. santosh -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of John BlakeSent: Wednesday, March 19, 2003 7:15 PMTo: Multiple recipients of list ORACLE-LSubject: RE: Rownum no, rownum

RE: ROWNUM strangeness?

2002-08-29 Thread Naveen Nahata
Post your query -Original Message- Sent: Thursday, August 29, 2002 9:23 PM To: Multiple recipients of list ORACLE-L I've been given a query to investigate. The performance varies extremely depending on whether the entire result set is fetched or a ROWNUM n clause is attached; that

Re: ROWNUM strangeness?

2002-08-29 Thread ltiu
Holes in your extents/segments. Normal. You get this after repeated updates/deletes/inserts. ltiu Paul Baumgartel wrote: I've been given a query to investigate. The performance varies extremely depending on whether the entire result set is fetched or a ROWNUM n clause is attached; that

RE: ROWNUM strangeness?

2002-08-29 Thread Ji, Richard
Hi Paul, How's going? Maybe there are other criteria's that limits the result set to only return 24 rows? Richard Ji -Original Message- Sent: Thursday, August 29, 2002 11:53 AM To: Multiple recipients of list ORACLE-L I've been given a query to investigate. The performance varies

Re: ROWNUM strangeness?

2002-08-29 Thread ltiu
Actually. Scratch my previous email on this matter. We have seen this problem before and I couldn't figure out how to fix it. ltiu Paul Baumgartel wrote: I've been given a query to investigate. The performance varies extremely depending on whether the entire result set is fetched or a ROWNUM

RE: ROWNUM strangeness?--SOLVED

2002-08-29 Thread Naveen Nahata
As we all know, ROWNUM is *usually* assigned when rows are read into the cache, before sorting; Always -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Naveen Nahata INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051

Re: ROWNUM strangeness?

2002-08-29 Thread Stephane Faroult
Paul Baumgartel wrote: I've been given a query to investigate. The performance varies extremely depending on whether the entire result set is fetched or a ROWNUM n clause is attached; that makes sense to me. What doesn't make sense is the following: if we add WHERE ROWNUM 50, the query

RE: ROWNUM strangeness?

2002-08-29 Thread Markham, Richard
Title: RE: ROWNUM strangeness? show the full sql please, perhaps its how you are grouping your conditions Paul Baumgartel wrote: I've been given a query to investigate. The performance varies extremely depending on whether the entire result set is fetched or a ROWNUM n clause

RE: ROWNUM strangeness?

2002-08-29 Thread Mercadante, Thomas F
Paul, It's because of how ROWNUM is interpreted. The first query only returned the first 50 rows it found and you got 24 that passed the rest of your criteria. The second query returned 1000 rows of which only 336 passed the rest of your criteria. Makes perfect sense to me. This is why

Re: ROWNUM strangeness?

2002-08-29 Thread Paul Baumgartel
I believe you have ROWNUM confused with ROWID. --- ltiu [EMAIL PROTECTED] wrote: Holes in your extents/segments. Normal. You get this after repeated updates/deletes/inserts. ltiu Paul Baumgartel wrote: I've been given a query to investigate. The performance varies extremely

RE: ROWNUM strangeness?

2002-08-29 Thread Fink, Dan
Actually, ROWNUM has nothing to do with extents/segments/inserts/updates/deletes. It is all about access paths. The solution posted makes sense as ROWNUM can be affected by many subsequent operations. -Original Message- Sent: Thursday, August 29, 2002 11:04 AM To: Multiple recipients of

RE: ROWNUM strangeness?--SOLVED

2002-08-29 Thread Fink, Dan
To be exact... Rownum is sequentially assigned for each row that meets the predicate. If the row does not match the predicate condition, it is discarded and not assigned a rownum. Below is an example using our friendly EMP table. As for sorting, rownum is assigned before any sorting. However,

Re: ROWNUM strangeness?

2002-08-29 Thread ltiu
I agree. I got confused and my second email to disregard my erroneous first emai on this matterl was apparently shot down by the mail filters so it never got to you guys in time. Sorry for the confision. ltiu Fink, Dan wrote: Actually, ROWNUM has nothing to do with

Re: ROWNUM strangeness?

2002-08-29 Thread ltiu
Yes sir. Paul Baumgartel wrote: I believe you have ROWNUM confused with ROWID. --- ltiu [EMAIL PROTECTED] wrote: Holes in your extents/segments. Normal. You get this after repeated updates/deletes/inserts. ltiu Paul Baumgartel wrote: I've been given a query to investigate. The

RE: ROWNUM strangeness?

2002-08-29 Thread Fink, Dan
It is not the predicate that causes the behavior, but the distinct. I'm taking an educated guess here, so please correct me if I am wrong. As the row is read, the predicate is applied. If the row matches the predicate, a rownum is assigned and it is saved as part of the result set. Once the

Re: ROWNUM strangeness?--SOLVED

2002-08-29 Thread Stephane Faroult
As for sorting, rownum is assigned before any sorting. However, if the data is read via an index, the rownum appears to be assigned after the sort. Dan, I wouldn't say that. What *appears* is the sort, which doesn't take place since data is fetched in sorted order. Rownum is assigned in the

Re: ROWNUM question ???

2002-02-09 Thread Stephane Faroult
Janet Linsy wrote: Hi, I have a table like this: SQL select * from test; ID PRICE -- -- 1 1 1 3 1 4 1 5 1 6 I need to get the second largest price and I was