I only want these first rows – 12c edition – Part 1
How many times have you tried to query just for the first few rows with a SQL statement like:
SELECT id, brewery, city, state, country FROM barmaid.beers WHERE rownum <10
Results:
In this first part of discussing Oracle’s new native SQL support for limiting rows, we are going to look at the FETCH and OFFSET options for the SELECT statement. With the release of Oracle Database 12c, Oracle has introduced this new SQL syntax to simplify fetching the first few rows.
The following statement returns the first 10 rows from the barrmaid.beers table.
SELECT id, brewery, city, state, country FROM barmaid.beer FETCH FIRST 10 ROWS ONLY;
Results. They actually look the same; however, I got the 10th row as well.
Part of this new SQL clause, we can specify an OFFSET. The OFFSET will then skip that number of rows and return the next rows fetched.
SELECT id, brewery, city, state, country FROM barmaid.beer OFFSET 10 ROWS FETCH FIRST 5 ROWS ONLY;
Results.
Hopefully, these examples have given you the basics of using the OFFSET and FETCH options of the SELECT statement.
Enjoy!
Twitter: @curtisbl294
Blog: http://dbasolved.com
Email: [email protected]
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
Wow! At last I got a website from where I know how to actually obtain useful facts
concerning my study and knowledge.
Take a look at my page – eharmony special coupon code 2025
Hi! I simply would like to offer you a huge thumbs up for
the excellent information you’ve got here on this post.
I am returning to your site for more soon.
my website :: vpn
Nice post. I learn something totally new and challenging on websites
Touche. Solid arguments. Keep up the great work. gamefly free trial https://tinyurl.com/27xe7che
I do not even understand how I ended up here, but I assumed this publish used to be great
For the reason that the admin of this site is working, no uncertainty very quickly it will be renowned, due to its quality contents.
I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.
Nice post. I learn something totally new and challenging on websites
I like the valuable information you provide in your articles.
I’ll bookmark your blog and check again here regularly. I’m quite sure I’ll
learn a lot of new stuff right here! Good luck for the next!
https://tinyurl.com/2atd6fak what is a vpn meaning