declare
val varchar2(1024);
val_new varchar2(1024);
i integer;
p1 integer;
p2 integer;
p3 integer;
p4 integer;
ip integer;
begin
val := '192.168.010.017';
p1 := 0;
p2 := 0;
p3 := 0;
p4 := 0;
i := instr(val,'.',1);
if i <> 0 then
val_new := substr(val,1,i-1);
p1 := to_number(val_new);
dbms_output.put_line(to_char(p1));
val := substr(val,i+1);
i := instr(val,'.',1);
if i <> 0 then
val_new := substr(val,1,i-1);
p2 := to_number(val_new);
dbms_output.put_line(to_char(p2));
val := substr(val,i+1);
i := instr(val,'.',1);
if i <> 0 then
val_new := substr(val,1,i-1);
p3 := to_number(val_new);
dbms_output.put_line(to_char(p3));
val := substr(val,i+1);
p4 := to_number(val);
dbms_output.put_line(to_char(p4));
end if;
end if;
end if;
ip := p4 + p3*(power(2,8)) + p2*(power(2,16)) + p1*(power(2,24));
dbms_output.put_line(to_char(ip));
exception
when others then
null;
end;