oracle blob过滤
发布时间:2020-12-12 14:24:30 所属栏目:百科 来源:网络整理
导读:private static String hexString = "0123456789ABCDEF";private static String encode(String str) {try{// 根据默认编码获取字节数组byte[] bytes = str.getBytes("UTF-8");StringBuilder sb = new StringBuilder(bytes.length * 2);// 将字节数组中每个字
private static String hexString = "0123456789ABCDEF"; private static String encode(String str) { try{ // 根据默认编码获取字节数组 byte[] bytes = str.getBytes("UTF-8"); StringBuilder sb = new StringBuilder(bytes.length * 2); // 将字节数组中每个字节拆解成2位16进制整数 for (int i = 0; i < bytes.length; i++) { sb.append(hexString.charAt((bytes[i] & 0xf0) >> 4)); sb.append(hexString.charAt((bytes[i] & 0x0f) >> 0)); } return sb.toString(); }catch(Exception e){ e.printStackTrace(); } return ""; } if(n_content!=null&&!n_content.equals("")){ n_content = encode(n_content); sql.append(" AND dbms_lob.instr(N_CONTENT,'"+n_content+"',1,1)<>0 "); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |