Oracle中SQL语句转化IP地址到数字
2013-10-14 22:13
393 查看
CREATE OR REPLACE FUNCTION ip_num(ipaddress IN VARCHAR2) RETURN NUMBER AS ipnum NUMBER := 0; pos1 NUMBER := 0; pos2 NUMBER := 0; BEGIN FOR i IN 1 .. 3 LOOP pos2 := to_number(instr(ipaddress, '.', 1, i)); ipnum := ipnum + to_number(substr(ipaddress, pos1 + 1, pos2 - pos1 - 1)) * power(2, 8 * (4 - i)); pos1 := pos2; END LOOP; ipnum := ipnum + to_number(substr(ipaddress, pos1 + 1)); RETURN ipnum; exception when others then return null; END; /
相关文章推荐
- oracle sql语句转化为mysql 容易忽略“||”作用
- Oracle查询Sql语句中的时间格式转化
- Oracle SQL语句操作数字:取整、四舍五入及格式化
- 多表查询语句写法、数据库数字如何转化为汉子、Sql语句拼接
- Oracle SQL语句实现数字四舍五入取整
- Oracle SQL语句操作数字:取整、四舍五入及格式化
- Oracle SQL语句操作数字:取整、四舍五入及格式化
- Oracle判断指定列是否全部为数字的sql语句
- Oracle判断指定列是否全部为数字的sql语句
- Oracle SQL语句实现数字四舍五入取整
- Oracle SQL语句操作数字:取整、四舍五入及格式化
- Oracle SQL语句操作数字:取整、四舍五入及格式化
- Oracle中用pl/sql实现货币数字格式到汉字格式的转化
- Oracle中PL/SQL的CASE语句
- ORACLE分页SQL语句
- 自己初学数据库的笔记(oracle为主) (附带在网上看到的一个对SQL语句的小结见附件)
- Oracle 查看表空间的大小及使用情况sql语句
- [转] Oracle数据库维护常用SQL语句集合
- 查询oracle最耗资源的sql语句
- Oracle PL/SQL语言基础_控制语句