Home » SQL & PL/SQL » SQL & PL/SQL » range from comma separated values
range from comma separated values [message #259959] Fri, 17 August 2007 00:18 Go to next message
srk12345
Messages: 4
Registered: August 2006
Junior Member
I have comma separated values and I would like format the values in terms of range..for example

A1, A2, A3, A6 should return A1-A3, A6
XX1, XX2, XX3, XX4, XX6, XX7, XX8, XX9 should return XX1-XX4, XX6-XX9
Z123, Z124, A125, A126, A127 should return Z123-Z124, A125-A127

etc...

is this possible to do in sql?

Re: range from comma separated values [message #259963 is a reply to message #259959] Fri, 17 August 2007 00:38 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
To do this, you should start with splitting the character and numeric piece of your string.
Then, grouped by the character part, order it by the numeric part.
After that, it will be a standard range query, as described several times on this site.
Re: range from comma separated values [message #259966 is a reply to message #259959] Fri, 17 August 2007 00:58 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Have a look at this topic:
http://www.orafaq.com/forum/t/87271/102589/

Regards
Michel
Re: range from comma separated values [message #260267 is a reply to message #259966] Fri, 17 August 2007 17:46 Go to previous messageGo to next message
srk12345
Messages: 4
Registered: August 2006
Junior Member
nice..that should work..will try..
thanks for the responses.
Re: range from comma separated values [message #262192 is a reply to message #259959] Fri, 24 August 2007 23:46 Go to previous message
Volder
Messages: 38
Registered: April 2007
Location: Russia
Member
For others who will struggle the same proble a link from OTN Forum
Previous Topic: CHANGE THE LEVEL NUMBER IN AN SQL QUERY (merged)
Next Topic: Audit history of pl/sql code..
Goto Forum:
  


Current Time: Thu Dec 08 10:22:23 CST 2016

Total time taken to generate the page: 0.17630 seconds