此函数用于求IP地址
create or replace function getipnum(ip_from number) return varchar2 as
ip varchar2(15);
begin
ip := trunc(ip_from / (256 * 256 * 256)) || '.' ||
trunc(mod(ip_from, 256 * 256 * 256) / (256 * 256)) || '.' ||
trunc(mod(ip_from, 256 * 256) / 256) || '.' || mod(ip_from, 256);
return ip;
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
end;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23446692/viewspace-692218/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23446692/viewspace-692218/
本文介绍了一个PL/SQL函数,该函数能够将整数形式的IP地址转换为标准的点分十进制格式。通过使用位运算和模运算,函数有效地分离了IP地址的每一部分。
377

被折叠的 条评论
为什么被折叠?



