三种数据库截取字段内容&&获取字符长度的函数如下

        if(databaseutil.getValue("database").equalsIgnoreCase("sqlserver")){
        	
       	 list =categoryFLDao.findBySQL("select id,substring(full_name,6,datalength(full_name)-6) from fhcb_08_tbl_category where full_id like '" + cid + "~%'and id!="+cid  );
	
        }else if(databaseutil.getValue("database").equalsIgnoreCase("mysql")){
        	 list =categoryFLDao.findBySQL("select id,substring(full_name,6,CHAR_LENGTH(full_name)-6) from fhcb_08_tbl_category where full_id like '" + cid + "~%'and id!="+cid  );
        }
        else if(databaseutil.getValue("database").equalsIgnoreCase("oracle")){
       	 list =categoryFLDao.findBySQL("select id,SUBSTR(full_name,6,LENGTH(full_name)-6) from fhcb_08_tbl_category where full_id like '" + cid + "~%'and id!="+cid  );

        }

  

posted @ 2019-08-01 12:24  黑魔法os  阅读(1004)  评论(0编辑  收藏  举报