Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to group numbers into ranges?

588171Sep 19 2007 — edited Mar 14 2008
Hi there,

I have table with a numerical ID field. The values in this column may or may not be consecutive. For example:

ID
--
1
2
4
5
6
8
9
10
11
12

Note, there are missing numbers. I need a query that will group the numbers into ranges like below:

LowerBound UpperBound
1 2
4 6
8 12

Any assistance appreciated! Thank you!

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 11 2008
Added on Sep 19 2007
27 comments
22,101 views