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

Home -> Community -> Usenet -> c.d.o.server -> Re: Select between range, not in...

Re: Select between range, not in...

From: Joachim Zobel <jzobel_at_my-dejanews.com>
Date: Fri, 12 Dec 2003 23:50:47 +0100
Message-ID: <pan.2003.12.12.22.50.47.250639@my-dejanews.com>


On Fri, 12 Dec 2003 09:48:44 -0800, Pret Orian wrote:

> Hi there!
> I have a table with used IP Adresses, and I have a table with
> subnetworks (with IP range: start/end).
> I need to make a select statement which would return the first free IP
> in range.
> The catch is I'd need to find a solution that would use basic SQL
> query as I have no permission to write SPs or functions.
>
> So this would be the table structures:
>
> Subnet:
> sune_id, ipstart, ipend, ...
>
> IPs:
> ..., sune_id, ipadress

These data have a consistency condition:

SELECT *
FROM subnet s, ips i
WHERE s.sune_id=i.sune_id
AND i.ipadress NOT BETWEEN s.ipstart AND s.ipend

should return no rows. Does it?

Sincerely,
Joachim

-- 
Warnung: \" kann Augenkrebs verursachen. 
Received on Fri Dec 12 2003 - 16:50:47 CST

Original text of this message

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