473,769 Members | 5,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OFFSET function in oracle

I want to retrieve a range of record
such as retrieving 11th to 20th records from 10000 records
In SQL Server, i can use the "OFFSET" function.
so i wanna ask does Oracle provide any function similar to "OFFSET" in SQL
SERVER?

Thanks in advance
Regards
Bun
Jul 19 '05 #1
7 13479
this may help you ....

select * from mytable where rownum <= 20
minus
select * from mytable where rownum <= 10
"¢Ð¢ý¢ö" <@.@> wrote in message news:<bp******* ***@imsp212.net vigator.com>...
I want to retrieve a range of record
such as retrieving 11th to 20th records from 10000 records
In SQL Server, i can use the "OFFSET" function.
so i wanna ask does Oracle provide any function similar to "OFFSET" in SQL
SERVER?

Thanks in advance
Regards
Bun

Jul 19 '05 #2
"Christine" <ka******@hotma il.com> wrote...
this may help you ....

select * from mytable where rownum <= 20
minus
select * from mytable where rownum <= 10


Hi Christine,

you're kidding, right?
Jul 19 '05 #3
Well write a little PL/SQL and do it yourself. It might look less
efficient than SQL Server, but that's pretty much what it does
internally.

ETA

"Guido Konsolke" <GK@oblivion.co m> wrote in message news:<10******* ********@news.t hyssen.com>...
"Christine" <ka******@hotma il.com> wrote...
this may help you ....

select * from mytable where rownum <= 20
minus
select * from mytable where rownum <= 10


Hi Christine,

you're kidding, right?

Jul 19 '05 #4
VC
select * from
( select t1.*, rownum rn from ( select * from t1 order by x ) t1
where rownum <= upper_limit )
where rn >= lower_limit;
"¢Ð¢ý¢ö" <@.@> wrote in message news:bp******** **@imsp212.netv igator.com...
I want to retrieve a range of record
such as retrieving 11th to 20th records from 10000 records
In SQL Server, i can use the "OFFSET" function.
so i wanna ask does Oracle provide any function similar to "OFFSET" in SQL
SERVER?

Thanks in advance
Regards
Bun

Jul 19 '05 #5
this question seems to pop up every few days

good solution, but don't forget to take a larger look at your application

if the user is paging thru a large set of records, consider some mechanism
to pre-select the PKs for the entire set and then use these to fetch each
page -- the performance trade off can come after only one or two pages. and
depending on your development tool, you could keep one cursor for doing the
PK fetches as needed, and use a second one for grabbing the current page of
data

-- mcs

"VC" <bo*******@hotm ail.com> wrote in message
news:Vppvb.2028 77$275.751945@a ttbi_s53...
| select * from
| ( select t1.*, rownum rn from ( select * from t1 order by x ) t1
| where rownum <= upper_limit )
| where rn >= lower_limit;
|
|
| "¢Ð¢ý¢ö" <@.@> wrote in message
news:bp******** **@imsp212.netv igator.com...
| > I want to retrieve a range of record
| > such as retrieving 11th to 20th records from 10000 records
| > In SQL Server, i can use the "OFFSET" function.
| > so i wanna ask does Oracle provide any function similar to "OFFSET" in
SQL
| > SERVER?
| >
| >
| >
| > Thanks in advance
| > Regards
| > Bun
| >
| >
|
|
Jul 19 '05 #6
"Guido Konsolke" <GK@oblivion.co m> wrote in message news:<10******* ********@news.t hyssen.com>...
"Christine" <ka******@hotma il.com> wrote...
this may help you ....

select * from mytable where rownum <= 20
minus
select * from mytable where rownum <= 10


Hi Christine,

you're kidding, right?


this should work ->

select rownum, * from mytable where rownum <= 20
minus
select rownum, * from mytable where rownum <= 10
Jul 19 '05 #7
how come i can't delete my meg???
THIS should work, really... ->

select rownum, col1, col2 ... from mytable where rownum <= 20
minus
select rownum, col1, col2 ... from mytable where rownum <= 10
* replace (col1, col2 ...) to whatever colname you want to select.
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1523
by: bergel | last post by:
Hello, Regarding the variable layout with multi inheritance, I looked into a couple of C++ books but I was not able to find a descent answer. Let assume I have the following: class A{ int x; } int A::getX(){ return x;}
0
5794
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ? SELECT ... ; ----> returns 100,000 rows
0
1308
by: Uthuras | last post by:
Greetings All, MAchine : INM Os : AIX 4.3.x Product : DB2 UDB Release : 6.1 DB2 seem to give the following error at the database server's console monitor continuously Feb 06 07:25:20 DB: offset 1fc in function
1
4787
by: bfirpo | last post by:
ok how can i get the register nº 10 whithout finding in all the registers of the table.? In mySQL would be: SELECT * FROM mytable LIMIT 1 OFFSET 10 In ORACLE: SELECT * FROM mytable ROWNUM 10 In ACCESS : ........ I can't find by the id because it's not correlative
1
1215
verbatim
by: verbatim | last post by:
I’m having a problem with FF2.0 trying to find the y offset of an object. I've tried several different scripts; all seem to be similar to this one. I keep getting strange values for the Y offset. In stylesheets, I set everything to zero: body { padding:0px; margin:0px }. then placed one single image on a blank page with an href around it. using mouseover to show me the y offset, I keep getting different y offsets depending on the height of...
8
11263
by: colmkav | last post by:
Can someone tell me how I can access the return value of a function called from Oracle as opposed to a store proc from oracle? my oracle function is get_num_dates_varposfile. I am only used to using this method with store procs that dont return a value back to Access. Hope this makes sense. Set Cmd = New Command With Cmd Set .ActiveConnection = get_XE_Conn 'makes a connection Oracle XE
5
246
by: ¢Ð¢ý¢ö | last post by:
I want to retrieve a range of record such as retrieving 11th to 20th records from 10000 records In SQL Server, i can use the "OFFSET" function. so i wanna ask does Oracle provide any function similar to "OFFSET" in SQL SERVER? Thanks in advance Regards
1
1380
by: Simon429 | last post by:
Hi, I got a client application where it calls the webservices to save and retreive dates from an Oracle database. 1 problem I've encountered is that when a user select a certain date in the client application, when this date got to the webservice, it got offset by 1 day (plus/minus 1 day depending on where is the user). Is there any easy solution where the date appears and saved as it is? i.e. user select 2nd July 2008, and the...
8
3998
by: Thomas Mlynarczyk | last post by:
Hello, I want to split a given string into tokens which are defined by regexes: // example tokens - a bit more complex in real $tokens = array( 'NUMBER' ='~^\d+~', 'NAME' ='~^+~', 'ANY' ='~^.~' ); // make sure there is always a match
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.