473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to use "rownum"

Hi,
I am doing a paging task. In order to do that I want to get data 10 by 10 raws from a table. How can I do this using "rownum" ?
I tried in this way

SELECT FROM (
SELECT UPLOAD_DATE_TIME,TYPE_OF_UPLOAD,PERFORMED_BY,STATU S,CLFILE_COUNT,STCMAS_COUNT,CLSTMAS_COUNT,OPENTRN_ COUNT,START_TIME,FINISH_TIME,rownum rn
FROM ONLINE_ACTION_HISTORY where TYPE_OF_UPLOAD='OPERATIONAL' ORDER BY UPLOAD_DATE_TIME DESC) WHERE rn between 1*10-9 and 1*10;

But row numbers are not in the order as table rows. It has different order. Please help me to solve this problem.
Thanks in advance
Nov 10 '10 #1
2 1925
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM(
  2. SELECT UPLOAD_DATE_TIME,TYPE_OF_UPLOAD,PERFORMED_BY,STATU S,CLFILE_COUNT,STCMAS_COUNT,CLSTMAS_COUNT,OPENTRN_ COUNT,START_TIME,FINISH_TIME,rownum rn FROM (
  3. SELECT UPLOAD_DATE_TIME,TYPE_OF_UPLOAD,PERFORMED_BY,STATU S,CLFILE_COUNT,STCMAS_COUNT,CLSTMAS_COUNT,OPENTRN_ COUNT,START_TIME,FINISH_TIME 
  4. FROM ONLINE_ACTION_HISTORY where TYPE_OF_UPLOAD='OPERATIONAL' ORDER BY UPLOAD_DATE_TIME DESC))
  5. WHERE rn between 1*10-9 and 1*10
  6. /
  7.  
Nov 15 '10 #2
I tried it and it works
Thanx Amith... :)
Nov 16 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Greg | last post by:
Can someone explain the uses & provide a simple use example of the following: -Rowcount -Rowid -Rowlevel -Rownum -Rows -Rowtype Thanks!
10
by: KENNY L. CHEN | last post by:
Dear experts, I have two tables in my Oracle 8i database: TEST (COL1,COl2,REC_NO) and TEST1 (COL1,COL2,REC_NO). Both tables are unique-indexed on (COL1,COL2,REC_NO). I think the following...
1
by: mlke | last post by:
I would like to select the top 10 record from a table? How can I do it? In MS SQL, it's easy using select top 10 from table1. But in oracle database, I can't use top, anyone have any suggestions?...
4
by: Flapper | last post by:
Help please, Have a situation when converting from Oracle SP's to SQL SP's. The old oracle cursor was roughly as follows CURSOR cur_rsStock IS select * from (select StockRowId, CategoryId
4
by: Mike Cooper | last post by:
There is something about inherited classes I evidently don't know... I wrote the following class: Class Class1 inherits System.Windows.Forms.DataGridTextBoxColumn End Class There is...
1
by: tkpmep | last post by:
I write data to Excel files using PyExcelerator 0.6.3.a and have done so successfully for small files (10-15 cells). I'm experiencing an error when writing a big chunk of data (10,000 cells) to...
2
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
Can someone help me understand how to use this example from MS in my code: string cityValue = "Seattle"; customersTableAdapter.FillByCity(northwindDataSet.Customers, cityValue); I am not sure...
17
by: pbd22 | last post by:
Hi. How does one return a range of rows. I know that "Top 5" will return rows 0 - 5 but, how do I get 6 - 10? thanks
5
by: Martin | last post by:
I'm trying to adapt a PHP script that was written to use MySQL, so that it will work with an MSAccess MDB file. An important part of the script makes use of the SQL "LIMIT" keyword available in...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.