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';