Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Sorting varchars that contain IP addresses
AMARENDRA B NETTEM wrote:
>
> Hi,
> TRY THIS SQL STATEMENT (assuming table name as 'table'
> and column as 'IP')
>
> select * from table
> order by TO_NUMBER(substr(IP,1,3)||SUBSTR(IP,5,2)||
> SUBSTR(IP,8,3)||SUBSTR(IP,12,2))
> --
This won't fly for all possible IP addresses.
Look at
129.83.14.2
129.183.50.34
Your offsets will be different.
But the followup by Jeremy will work. Received on Thu Jul 31 1997 - 00:00:00 CDT
![]() |
![]() |