Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sorting varchars that contain IP addresses

Re: Sorting varchars that contain IP addresses

From: Steve Dover <killspam_at_dev.null>
Date: 1997/07/31
Message-ID: <33E1212F.3B03@dev.null>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US