Results 1 to 15 of 15
Thread: Rownum in oracle?
- 06-22-2011, 10:57 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
- 06-22-2011, 11:03 AM #2
- 06-22-2011, 11:20 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Also read the link at the bottom of that page ("On a table's first five rows").
Because your first query above is essentially saying "give me five rows from the test table". It can return different results at different times.Last edited by Tolls; 06-22-2011 at 11:21 AM. Reason: Fix first sentence
- 06-22-2011, 11:49 AM #4
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
- 06-22-2011, 11:57 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
And?
What happens if you delete a row?
What happens if you add 100 rows?
Oracle can rejig the layout of rows in its memory as and when it feels a need.
Oracle does not guarantee the order rows are returned in without an ORDER BY statement, so that same query is essentially picking any 5 rows from that table.
- 06-22-2011, 12:54 PM #6
You seem to have missed the point that rownum applies to the row number in the query result, not to the row number in the table.
Why do people have to repeat here what's expressed very clearly in the linked web page?
db
- 06-22-2011, 12:59 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
- 06-22-2011, 01:33 PM #8
Visual FoxPro has a RECNO() function that returns the row number (record number, in VFP parlance) in the data table. So in VFP you can
dbJava Code:SELECT * FROM Test WHERE RECNO() > 1
- 06-22-2011, 01:38 PM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Maybe I should have said "real RDBMS"...;)
- 06-22-2011, 02:25 PM #10
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
select * from (select rownum r ,max_manual_per from test) where r >1;
this query work fine
so what mechanism for rownum concept in oracle...
can u explain me if u know....
- 06-22-2011, 02:40 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
That works because the subquery has numbered the rows.
SELECT * FROM test WHERE rownum > 1 will return nothing.
And we have explained the concept.
Rownum is an identifier applied to the rows of a resultset.
- 06-22-2011, 02:50 PM #12
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
but when we check rownum>1 then no row selected
but when we check rownum = 1 then one record found
so what is concept for that
- 06-22-2011, 02:58 PM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Since rownum is something assigned as the resultset is built, then nothing can have a rownum > 1, since the first row is rejected each time.
- 06-23-2011, 06:26 AM #14
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
thank for answer....
- 06-23-2011, 07:05 AM #15
Similar Threads
-
Oracle VM=Sun VM after oracle bought Sunmicrosystem?
By jackiewu09 in forum Advanced JavaReplies: 0Last Post: 05-16-2011, 10:28 PM -
Exchanging Oracle DB (1Z0-) Vouchers for Oracle Sun (310-) Vouchers
By Nightbliss in forum Java CertificationReplies: 2Last Post: 05-11-2011, 09:02 AM -
new to oracle
By emmett01 in forum JDBCReplies: 4Last Post: 11-15-2009, 06:16 AM -
connection with Oracle 10g
By Somitesh Chakraborty in forum New To JavaReplies: 5Last Post: 11-20-2008, 07:19 PM -
why oracle index can't work correctly in oracle?
By wwwlife in forum JDBCReplies: 0Last Post: 08-27-2008, 09:27 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks