查询未通过代码运行

时间:2016-01-26 06:24:21

标签: sql hibernate

我有以下查询,我通过Hibernate运行

query.append("("SELECT TABLE_01##.name,TABLE_02##.name AS assembly, TABLE_01##.wnumber ||'' '' AS doc, TABLE_03##.OPN,"
                + "DECODE(SUBSTR(TABLE_04##.COMMOD_CODE,1,2),''CP'',TABLE_05##.enumber,''JK'',TABLE_05##.enumber) AS END_ITEM, "
                + "DECODE(SUBSTR(TABLE_04##.COMMOD_CODE,1,2),''CP'',TABLE_05##.FROM_CSN,''JK'',TABLE_05##.FROM_CSN) AS CSN, "
                + "NVL2(TABLE_03##.QREQ,TABLE_03##.QREQ-TABLE_03##.ATABLE_03##.QTY_I, "
                + "TABLE_01##.QREQ-TABLE_01##.ATABLE_01##.QTY_I)AS QTYB, "
                + "TO_CHAR(TABLE_01##.DATE_REQD,''yyyymmdd''), TABLE_01##.STK, TABLE_02##.PERF_WC,"
                + "TO_CHAR(TABLE_01##.DATE_REQD,''yyyymmdd'') AS SORT_DATE"
                + " FROM TABLE_04## "
                + "INNER JOIN (((TABLE_01## INNER JOIN TABLE_02## ON TABLE_01##.wnumber = TABLE_02##.wnumber) "
                + "LEFT JOIN TABLE_03## ON TABLE_01##.NREQ = TABLE_03##.NREQ) "
                + "LEFT JOIN TABLE_05## ON TABLE_01##.wnumber = TABLE_05##.wnumber)ON TABLE_04##.name ="
                + "TABLE_02##.name WHERE TABLE_01##.name =''{0}'' "
                + "AND ((NVL2(TABLE_03##.QREQ,TABLE_03##.QREQ-TABLE_03##.ATABLE_03##.QTY_I, "
                + "TABLE_01##.QREQ-TABLE_01##.ATABLE_01##.QTY_I))<0) "
                + "AND ((TABLE_02##.R_FLG)<>''C'') AND ((TABLE_01##.B_FLAG)=''Y'') ");

当我打印在sqldeveloper中生成的查询的输出但是当我尝试通过代码运行它时,它会运行,它表示无效的列名。

10:52:58,224 WARN  [org.hibernate.util.JDBCExceptionReporter] (http-localhost-127.0.0.1-8080-1) SQL Error: 17006, SQLState: 99999
10:52:58,224 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-localhost-127.0.0.1-8080-1) Invalid column name
10:52:58,224 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) org.hibernate.exception.GenericJDBCException: could not execute query

任何帮助?

0 个答案:

没有答案