title: IP address stored as decimal - PL/SQL to display as dotted quad
body: <p>We have an Oracle database that contains IP addresses stored as decimal integers - this is incredibly painful when manipulating the data by hand instead of via the web interface, yet hand manipulation is really handy as the network guys continually ask us to do strange things that the web interface authors did not anticipate.</p>
  
  <p>Could someone provide me with the PL/SQL or other method to display these decimal IPs as dotted decimal i.e. 123.123.123.123 format?</p>
  
  <p>I.e. I'd like to be able to run a query such as :</p>
  
  <pre><code>select hostname, inttoip(ip_address) from host;
  </code></pre>
  
  <p>and have the <code>inttoip()</code> procedure display ip_address as 203.30.237.2 instead of as 3407801602.</p>
  
  <p>Ideally I'd like a procedure which provides the inverse function too, e.g.</p>
  
  <pre><code>insert into host (hostname,ip_address) values ('some-hostname', iptoint('203.30.237.2'));
  </code></pre>
  
  <p>I have perl to do this, but my PL/SQL/Oracle knowledge is not good enough to port it into PL/SQL.</p>
  
  <p><br/></p>
  
  <p><strong><em>Alternatively</em></strong> a way to run the perl as the procedural language within  the oracle context analogous to the following in postgres:</p>
  
  <pre><code>CREATE FUNCTION perl_func (integer) RETURNS integer AS $$
   &lt;some perl&gt;
  $$ LANGUAGE plperl;
  </code></pre>
  
  <p>Would be great - if possible - probably even better as I could then do lots of procedural stuff within Oracle in a language I am familiar with.</p>