*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 222

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



Oracle Java Programmer , Oracle SQL Expert
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

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: 222

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
SQL query for top ten students
How a single value is retrieved for the query? Query= to find the nth best element
Lucene Reindex