File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Explain working of Rownum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Explain working of Rownum" Watch "Explain working of Rownum" New topic
Author

Explain working of Rownum

Mahtab Alam
Ranch Hand

Joined: Mar 28, 2012
Posts: 172

This is the table account having two columns name and salary

name salary
A 1000
B 1500
C 1300
D 1200
E 1400
F 1100



ROWNUM NAME SALARY
---------------------------------------
1 B 1500
2 E 1400
3 C 1300
This query returns the Highest three salaries

But when I just want to retrieve top most salary It says No Rows Selected what that means



Mahtab Alam (OCJP )
Blogs : alamsql.blogspot.in , alammahtab.blogspot.in
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3433
    
  47

Is it Oracle? I cannot reproduce the issue, I'm getting one row with the rownum = 1 condition.
Mahtab Alam
Ranch Hand

Joined: Mar 28, 2012
Posts: 172

Yes it is Oracle
When I try this in the browser it works as expected but It says "No rows selected" when I use SQL*PLUS command line.

I have SQL* plus release 10.2.0.

Thank you for your time
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Explain working of Rownum
 
Similar Threads
Top N Analysis
retrieve nth salary thru optimized sql query
How a single value is retrieved for the query? Query= to find the nth best element
Lucene Reindex
SQL query for top ten students