zoukankan      html  css  js  c++  java
  • 使用wm_concat函数导致字符串过长

    场景:使用select wm_concat(xxxxx) from table 的时候 返回的字符串过长 

    解决方案 :使用to_clob 将字符串转成 clob类型,但是由于使用的前端框架不能解析clob类型的值

          再将clob转化成String类型 

          

    List<Map> olists=oDao.queryOrgRoleInfo(query);
            for(Map omap :olists ){
                try {
                    omap.put("ORGNAME", ClobToString((Clob)omap.get("ORGNAME")));
                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
     public String ClobToString(Clob clob) throws SQLException, IOException {
              
               String reString = "";
                   if (clob == null){
                   return "";
                   }
                Reader is = clob.getCharacterStream();// 得到流
                BufferedReader br = new BufferedReader(is);
                String s = br.readLine();
                StringBuffer sb = new StringBuffer();
                while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
                 sb.append(s);
                 s = br.readLine();
                }
                reString = sb.toString();
                return reString;
              }
  • 相关阅读:
    JavaScript解析顺序和变量作用域
    JS-BOM
    原生对象-Array
    JavaScript01
    css3动画
    scc的使用
    CSS3学习总结
    Js数组方法大全
    JavaScript判断变量是否为数组
    浏览器兼容性问题及解决方案
  • 原文地址:https://www.cnblogs.com/LEEEEEASON/p/9285354.html
Copyright © 2011-2022 走看看