oracle 数据库添加Java方法

create or replace and compile java source named "Bitconverter" as
public class Bitconverter {
public static long getLong(String data) {
byte[] bb = data.getBytes();
return ((((long) bb[0] & 0xff) << 56) | (((long) bb[1] & 0xff) << 48) | (((long) bb[2] & 0xff) << 40) | (((long) bb[3] & 0xff) << 32)
| (((long) bb[4] & 0xff) << 24) | (((long) bb[5] & 0xff) << 16) | (((long) bb[6] & 0xff) << 8) | (((long) bb[7] & 0xff) << 0));
}
}

create or replace function toint64(d in varchar2) return number as language java name 'Bitconverter.getLong(java.lang.String) return long';

posted @ 2015-09-15 14:25  真大闸蟹  阅读(272)  评论(0编辑  收藏  举报