We have an Oracle database that contains IP addresses stored as decimal integers - this is incredibly painful when manipulating data manually, and not through the web interface, however, manipulating the hands is really convenient, since the guys from the network constantly ask us to do strange things that web interface authors did not expect.
Can someone provide me with PL / SQL or another method for displaying these decimal IP addresses as dot decimal numbers, i.e. 123.123.123.123 format?
those. I would like to be able to run a query, for example:
select hostname, inttoip(ip_address) from host;
and in the inttoip() procedure, inttoip() displayed as 203.30.237.2 instead of 3407801602.
Ideally, I need a procedure that also provides an inverse function, like
insert into host (hostname,ip_address) values ('some-hostname', iptoint('203.30.237.2'));
I have perl to do this, but my knowledge of PL / SQL / Oracle is not good enough to port it to PL / SQL.
An alternative way to run perl as a procedural language in an oracle context is similar to the following in postgres:
CREATE FUNCTION perl_func (integer) RETURNS integer AS $$ <some perl> $$ LANGUAGE plperl;
It would be great - if possible - perhaps even better than I could do a lot of procedural things in Oracle in a language I am familiar with.