M
Monica Roman
I've read a lot of the threads on this conversion but could not figure
out which one is the correct function.
I have never written PERL before, but I want to give it a try and be
able to convert decimal numbers into IP addresses in the PERL script
used to load the IPs plus other data into an Oracle database. Right
now I use a SQL function within Oracle, but it slows down everything!
Can someone help the translate into PERL the following SQL function?
create or replace function int2ip(ip int)
return varchar2
is
ip_address varchar2(15);
t number;
w int(3);
x int(3);
y int(3);
z int(3);
begin
t:= ip / 256;
w:= 256 * (t - FLOOR(t));
t:= (FLOOR (t))/ 256;
x:= 256 * (t - FLOOR(t));
t:= (FLOOR (t)) / 256;
y:= 256 * (t - FLOOR(t));
z:= FLOOR (t);
ip_address := z||'.'||y||'.'||x||'.'||w;
return ip_address;
end int2ip;
Thank you very much,
Monica Roman
out which one is the correct function.
I have never written PERL before, but I want to give it a try and be
able to convert decimal numbers into IP addresses in the PERL script
used to load the IPs plus other data into an Oracle database. Right
now I use a SQL function within Oracle, but it slows down everything!
Can someone help the translate into PERL the following SQL function?
create or replace function int2ip(ip int)
return varchar2
is
ip_address varchar2(15);
t number;
w int(3);
x int(3);
y int(3);
z int(3);
begin
t:= ip / 256;
w:= 256 * (t - FLOOR(t));
t:= (FLOOR (t))/ 256;
x:= 256 * (t - FLOOR(t));
t:= (FLOOR (t)) / 256;
y:= 256 * (t - FLOOR(t));
z:= FLOOR (t);
ip_address := z||'.'||y||'.'||x||'.'||w;
return ip_address;
end int2ip;
Thank you very much,
Monica Roman