NutzCN Logo
问答 NUTZ运行sql报错
发布于 2418天前 作者 qq_589def95 2864 次浏览 复制 上一个帖子 下一个帖子
标签:

我刚开始使用nutz,在用自定义sql的时候,最后执行Sql的时候,nutz抛异常,查看异常信息,毫无头绪,找不到什么原因,原语句拷贝到navicat中可以完美运行,用nutz就会异常,还希望大神可以帮忙解决一下,感激不尽。
以下为JAVA代码:

  Sql sql = Sqls.create("SELECT A.STAT_MO, A.usr_cnt, A.fluct, A.branch_cnt, b.cmcc_cty_nam, B.usr_cnt, CAST(B.usr_cnt AS DECIMAL(5, 2)) / A.total_usr_cnt AS usr_rt FROM ( SELECT A.STAT_MO, SUM(A.usr_cnt) AS usr_cnt, ( cast( SUM(A.usr_cnt) AS DECIMAL (16, 2)) - cast( SUM(A.last_usr_cnt) AS DECIMAL (16, 2))) / SUM(A.last_usr_cnt) AS fluct, COUNT(DISTINCT A.cmcc_branch_cd) AS branch_cnt, sum(total_usr_cnt) AS total_usr_cnt FROM $tableName A WHERE STAT_MO = $statMo GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, a.cmcc_cty_nam, a.usr_cnt FROM $tableName A JOIN ( SELECT a.STAT_MO, a.CMCC_BRANCH_CD, count(*) AS RNK FROM $tableName a, $tableName b WHERE a.usr_cnt <= b.usr_cnt AND a.STAT_MO = $statMo AND b.STAT_MO = $statMo GROUP BY a.STAT_MO, a.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = $statMo ) b ON a.stat_mo = b.stat_mo");

        String tableName = "";
        if (Constant.TIME_ILLEGAL.equals(wgType)){
            tableName = "TM_AUDIT_HOMEBRB_HALFDAY_RPT_M";
        }else if (Constant.FLUX_ILLEGAL.equals(wgType)){
            tableName = "TM_AUDIT_HOMEBRB_THIRTYM_RPT_M";
        }else{
            tableName = "TM_AUDIT_HOMEBRB_HALFTHIRTY_RPT_M";
        }
        sql.vars().set("statMo", statMo);
        sql.vars().set("tableName", tableName);
        sql.setCallback(Sqls.callback.records());
        try {
            this.getDao().execute(sql);
        }catch (Exception e){
            System.out.println(e.getMessage());
        }

        return sql.getList(Record.class);

以下为打印出的异常:

!Nutz SQL Error: 'SELECT A.STAT_MO, A.usr_cnt, A.fluct, A.branch_cnt, b.cmcc_cty_nam, B.usr_cnt, CAST(B.usr_cnt AS DECIMAL(5, 2)) / A.total_usr_cnt AS usr_rt FROM ( SELECT A.STAT_MO, SUM(A.usr_cnt) AS usr_cnt, ( cast( SUM(A.usr_cnt) AS DECIMAL (16, 2)) - cast( SUM(A.last_usr_cnt) AS DECIMAL (16, 2))) / SUM(A.last_usr_cnt) AS fluct, COUNT(DISTINCT A.cmcc_branch_cd) AS branch_cnt, sum(total_usr_cnt) AS total_usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A WHERE STAT_MO = 201710 GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, a.cmcc_cty_nam, a.usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A JOIN ( SELECT a.STAT_MO, a.CMCC_BRANCH_CD, count(*) AS RNK FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M a, TM_AUDIT_HOMEBRB_HALFDAY_RPT_M b WHERE a.usr_cnt <= b.usr_cnt AND a.STAT_MO = 201710 AND b.STAT_MO = 201710 GROUP BY a.STAT_MO, a.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = 201710 ) b ON a.stat_mo = b.stat_mo'
PreparedStatement: 
'SELECT A.STAT_MO, A.usr_cnt, A.fluct, A.branch_cnt, b.cmcc_cty_nam, B.usr_cnt, CAST(B.usr_cnt AS DECIMAL(5, 2)) / A.total_usr_cnt AS usr_rt FROM ( SELECT A.STAT_MO, SUM(A.usr_cnt) AS usr_cnt, ( cast( SUM(A.usr_cnt) AS DECIMAL (16, 2)) - cast( SUM(A.last_usr_cnt) AS DECIMAL (16, 2))) / SUM(A.last_usr_cnt) AS fluct, COUNT(DISTINCT A.cmcc_branch_cd) AS branch_cnt, sum(total_usr_cnt) AS total_usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A WHERE STAT_MO = 201710 GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, a.cmcc_cty_nam, a.usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A JOIN ( SELECT a.STAT_MO, a.CMCC_BRANCH_CD, count(*) AS RNK FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M a, TM_AUDIT_HOMEBRB_HALFDAY_RPT_M b WHERE a.usr_cnt <= b.usr_cnt AND a.STAT_MO = 201710 AND b.STAT_MO = 201710 GROUP BY a.STAT_MO, a.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = 201710 ) b ON a.stat_mo = b.stat_mo'
16:53:04,519 ERROR http-apr-8081-exec-1 controller.ExceptionController:77 - web 00004:
null
28 回复

报错信息还是补全, try catch然后log.info输出完整信息

报错信息还是不全

大师 即使使用loginfo 打印出来的还是这些信息

try {
            this.getDao().execute(sql);
        }catch (Exception e){
            log.info("--查询异常--"+e.getMessage());

        }
17:12:26,296  INFO http-apr-8081-exec-7 nutz.SustainedAuditDaoImpl:876 - --查询异常--!Nutz SQL Error: 'SELECT A.STAT_MO, A.usr_cnt, A.fluct, A.branch_cnt, b.cmcc_cty_nam, B.usr_cnt, CAST(B.usr_cnt AS DECIMAL(5, 2)) / A.total_usr_cnt AS usr_rt FROM ( SELECT A.STAT_MO, SUM(A.usr_cnt) AS usr_cnt, ( cast( SUM(A.usr_cnt) AS DECIMAL (16, 2)) - cast( SUM(A.last_usr_cnt) AS DECIMAL (16, 2))) / SUM(A.last_usr_cnt) AS fluct, COUNT(DISTINCT A.cmcc_branch_cd) AS branch_cnt, sum(total_usr_cnt) AS total_usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A WHERE STAT_MO = 201710 GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, a.cmcc_cty_nam, a.usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A JOIN ( SELECT a.STAT_MO, a.CMCC_BRANCH_CD, count(*) AS RNK FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M a, TM_AUDIT_HOMEBRB_HALFDAY_RPT_M b WHERE a.usr_cnt <= b.usr_cnt AND a.STAT_MO = 201710 AND b.STAT_MO = 201710 GROUP BY a.STAT_MO, a.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = 201710 ) b ON a.stat_mo = b.stat_mo'
PreparedStatement: 
'SELECT A.STAT_MO, A.usr_cnt, A.fluct, A.branch_cnt, b.cmcc_cty_nam, B.usr_cnt, CAST(B.usr_cnt AS DECIMAL(5, 2)) / A.total_usr_cnt AS usr_rt FROM ( SELECT A.STAT_MO, SUM(A.usr_cnt) AS usr_cnt, ( cast( SUM(A.usr_cnt) AS DECIMAL (16, 2)) - cast( SUM(A.last_usr_cnt) AS DECIMAL (16, 2))) / SUM(A.last_usr_cnt) AS fluct, COUNT(DISTINCT A.cmcc_branch_cd) AS branch_cnt, sum(total_usr_cnt) AS total_usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A WHERE STAT_MO = 201710 GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, a.cmcc_cty_nam, a.usr_cnt FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A JOIN ( SELECT a.STAT_MO, a.CMCC_BRANCH_CD, count(*) AS RNK FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M a, TM_AUDIT_HOMEBRB_HALFDAY_RPT_M b WHERE a.usr_cnt <= b.usr_cnt AND a.STAT_MO = 201710 AND b.STAT_MO = 201710 GROUP BY a.STAT_MO, a.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = 201710 ) b ON a.stat_mo = b.stat_mo'
/audit2/page/public/vendor/layui/lay/modules/layer.js
17:12:26,303 ERROR http-apr-8081-exec-7 controller.ExceptionController:77 - web 00004:
null

这样写

log.info("--查询异常--", e);

果然仔细检查e 我找到问题所在了 分厂感谢 我试试自己能解决不?

大师 还是有问题啊 他提示变量错误 可是数据库中明明有这个变量啊

Unknown column 'A.last_usr_cnt' in 'field list'

单挑Sql 拿出来执行 是完全正确的啊

这又是大写的A和B,又是小写的a和b, 你确定能看清楚???

还有一个很常见的原因, 连错数据库

我擦………………大师一语惊醒梦中人啊
果然是连错了数据库 可为什么数据库不对的话 nutz报的是这种变量不存在的错误 不应该是表不存在才对么?好尴尬

既然不是报表不存在,那表的确是存在的

也是醉了 语句直接贴在JAVA代码里  是可以运行的  
然后我把语句丢到一个文件里之后  再用scanner把语句读出来之后 又是各种报错……

类似这样

 String filePath = path + "sql/report_sql_jkyh.txt";
        String sqlStr = FileUtils.readByScanner(filePath, Constant.CHAR_UTF_8);
        String statMo = String.valueOf(statMo2);
        System.out.println(sqlStr);
        Sql sql = Sqls.create(sqlStr);
……下面没变

又是语句错误……

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT A.STAT_MO, A.USR_CNT, A.FLUCT, A.BRANCH_CNT, B.CMCC_CTY_NAM, B.USR_CNT' at line 1

然而 我真的确信语句丝毫没错

从fileutils里读出来的语句也是i正常的

贴完整报错信息

从文件中读取之后的报错信息

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT A.STAT_MO, A.USR_CNT, A.FLUCT, A.BRANCH_CNT, B.CMCC_CTY_NAM, B.USR_CNT' at line 1

知道什么叫 "完整" 不?

这是fileutils读取出来的sql语句:

SELECT A.STAT_MO, A.USR_CNT, A.FLUCT, A.BRANCH_CNT, B.CMCC_CTY_NAM, B.USR_CNT, B.USR_CNT / A.TOTAL_USR_CNT AS USR_RT FROM ( SELECT A.STAT_MO, SUM(A.USR_CNT) AS USR_CNT, ( SUM(A.USR_CNT) - SUM(A.LAST_USR_CNT)) / SUM(A.LAST_USR_CNT) AS FLUCT, COUNT(DISTINCT A.CMCC_BRANCH_CD) AS BRANCH_CNT, SUM(TOTAL_USR_CNT) AS TOTAL_USR_CNT FROM $TABLENAME A WHERE STAT_MO = $STATMO GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, A.CMCC_CTY_NAM, A.USR_CNT FROM $TABLENAME A JOIN ( SELECT A.STAT_MO, A.CMCC_BRANCH_CD, COUNT(*) AS RNK FROM $TABLENAME A, $TABLENAME B WHERE A.USR_CNT <= B.USR_CNT AND A.STAT_MO = $STATMO AND B.STAT_MO = $STATMO GROUP BY A.STAT_MO, A.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = $STATMO ) B ON A.STAT_MO = B.STAT_MO 

这是完整异常信息

org.nutz.dao.DaoException: !Nutz SQL Error: 'SELECT A.STAT_MO, A.USR_CNT, A.FLUCT, A.BRANCH_CNT, B.CMCC_CTY_NAM, B.USR_CNT, B.USR_CNT / A.TOTAL_USR_CNT AS USR_RT FROM ( SELECT A.STAT_MO, SUM(A.USR_CNT) AS USR_CNT, ( SUM(A.USR_CNT) - SUM(A.LAST_USR_CNT)) / SUM(A.LAST_USR_CNT) AS FLUCT, COUNT(DISTINCT A.CMCC_BRANCH_CD) AS BRANCH_CNT, SUM(TOTAL_USR_CNT) AS TOTAL_USR_CNT FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A WHERE STAT_MO = 201710 GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, A.CMCC_CTY_NAM, A.USR_CNT FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A JOIN ( SELECT A.STAT_MO, A.CMCC_BRANCH_CD, COUNT(*) AS RNK FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A, TM_AUDIT_HOMEBRB_HALFDAY_RPT_M B WHERE A.USR_CNT <= B.USR_CNT AND A.STAT_MO = 201710 AND B.STAT_MO = 201710 GROUP BY A.STAT_MO, A.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = 201710 ) B ON A.STAT_MO = B.STAT_MO'
PreparedStatement: 
'SELECT A.STAT_MO, A.USR_CNT, A.FLUCT, A.BRANCH_CNT, B.CMCC_CTY_NAM, B.USR_CNT, B.USR_CNT / A.TOTAL_USR_CNT AS USR_RT FROM ( SELECT A.STAT_MO, SUM(A.USR_CNT) AS USR_CNT, ( SUM(A.USR_CNT) - SUM(A.LAST_USR_CNT)) / SUM(A.LAST_USR_CNT) AS FLUCT, COUNT(DISTINCT A.CMCC_BRANCH_CD) AS BRANCH_CNT, SUM(TOTAL_USR_CNT) AS TOTAL_USR_CNT FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A WHERE STAT_MO = 201710 GROUP BY A.STAT_MO ) A JOIN ( SELECT A.STAT_MO, A.CMCC_CTY_NAM, A.USR_CNT FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A JOIN ( SELECT A.STAT_MO, A.CMCC_BRANCH_CD, COUNT(*) AS RNK FROM TM_AUDIT_HOMEBRB_HALFDAY_RPT_M A, TM_AUDIT_HOMEBRB_HALFDAY_RPT_M B WHERE A.USR_CNT <= B.USR_CNT AND A.STAT_MO = 201710 AND B.STAT_MO = 201710 GROUP BY A.STAT_MO, A.CMCC_BRANCH_CD ) B ON A.STAT_MO = B.STAT_MO AND B.RNK = 1 AND A.CMCC_BRANCH_CD = B.CMCC_BRANCH_CD WHERE A.STAT_MO = 201710 ) B ON A.STAT_MO = B.STAT_MO'
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:86)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:242)
	at com.revenco.bi.dao.nutz.SpringDaoRunner.run(SpringDaoRunner.java:23)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:197)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:175)
	at com.revenco.bi.dao.nutz.SustainedAuditDaoImpl.getJKYHServiceDirectionSumReport(SustainedAuditDaoImpl.java:875)
	at com.revenco.bi.service.impl.SustainedAuditServiceImpl.getJKYHServiceDirectionSumReport(SustainedAuditServiceImpl.java:522)
	at com.revenco.bi.web.controller.SustainedAuditController.getServiceDirectionSumReport(SustainedAuditController.java:259)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:685)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at com.revenco.bi.util.security.SecurityFilter.doFilter(SecurityFilter.java:39)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2442)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2431)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT A.STAT_MO, A.USR_CNT, A.FLUCT, A.BRANCH_CNT, B.CMCC_CTY_NAM, B.USR_CNT' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2828)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2777)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:949)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:795)
	at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
	at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runStatement(NutDaoExecutor.java:304)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:72)
	... 52 more

A.USR_CNT与B.USR_CNT重名了吧

这sql是改了很多版本了?

是啊 会比较复杂

既然sql里面只有变量,那么打印的sql就是实际执行的sql,直接走jdbc也会是一样的报错

很感谢 大师 我果断放弃了 把sql就写到JAVA代码里面去吧 实在找不出任何问题 一下去就耗在这上面了 太坑

文件里面有特殊字符吧

或者不可见字符

添加回复
请先登陆
回到顶部