ibatis诡异的错误

错误如下:

  com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred in config/CTS_CHECK_TICKET_ET.xml.  

--- The error occurred while applying a parameter map.  

--- Check the CTS_CHECK_TICKET_ET.selectRtorderDetailByRtorderid-InlineParameterMap.  

--- Check the statement (query failed).  

--- Cause: java.sql.SQLException: ORA-01031: insufficient privileges


表面上看是oracle权限问题。

但实际不是如此,报错的sql如下:
<select id="selectRtorderDetailByRtorderid" parameterClass="CheckTicketMap" resultMap="RTOrderDetailResult" >
  SELECT PLEAVE_DT, ARRIVE_PERIOD, RLEAVE_DT, ALTER_REASON_CONTENT, 
           RTORDER_ID, RTORDER_CODE, REMARK, CREATOR, CREATE_DT, PTHALL_ID, 
           ORDER_ID, ORDER_CODE, LINE_ID, TICKET_GATE_ID, BC_ORDERATTR_ID, BC_ORDERTYPE_ID, 
           BC_ORDERMARKET_ID, BC_ORDERMANAGE_ID, BC_ROADTYPE_ID, ORDER_ALTER_TYPE, 
           BC_ALTERREASON_ID, ORDER_NAME,CHECKIN_STATUS,
           PLEAVE_DATE, PLEAVE_TIME, 
           BEGIN_STATION_ID, END_STATION_ID, LINE_SPACE, LINE_NAME, 
           BEGINSTATION_NAME, ENDSTATION_NAME, 
           PASSAGE_NAME, TICKET_GATE_NAME, 
           BUS_ID, LICENSE_ID, BC_BUSGRADE_ID, BC_BUSTYPE_ID, DRIVER_LIST,
           CARRIER_NAME, QUALITY_SUM, UNSALED_SEAT, ARRIVE_PERIODSTR, PASSAGE_ID , rownum rr,
           stationPrint,full_COUNT,half_COUNT,PRICE_FULL,PRICE_Semi
       from (
             SELECT BR.PLEAVE_DT, BR.ARRIVE_PERIOD, BR.RLEAVE_DT, BR.ALTER_REASON_CONTENT, 
                   BR.RTORDER_ID, BR.RTORDER_CODE, BR.REMARK, BR.CREATOR, BR.CREATE_DT, BR.PTHALL_ID, 
                   BR.ORDER_ID, BO.ORDER_CODE, BR.LINE_ID, BR.TICKET_GATE_ID, BR.BC_ORDERATTR_ID, BR.BC_ORDERTYPE_ID, 
                   BR.BC_ORDERMARKET_ID, BR.BC_ORDERMANAGE_ID, BR.BC_ROADTYPE_ID, BR.ORDER_ALTER_TYPE, 
                   BR.BC_ALTERREASON_ID, BR.ORDER_NAME,BR.CHECKIN_STATUS,
                   BOS_GETDRIVERIDS_FN(BR.RTORDER_ID) DRIVER_LIST,
                   SUBSTR(BR.PLEAVE_DT, 0, 10) PLEAVE_DATE, SUBSTR(BR.PLEAVE_DT, 11) PLEAVE_TIME,
                   BL.BEGIN_STATION_ID, BL.END_STATION_ID, BL.LINE_SPACE, BL.LINE_NAME,
                   BSB.STATION_NAME BEGINSTATION_NAME, BSE.STATION_NAME ENDSTATION_NAME,
                   BT.PASSAGE_ID, BP.PASSAGE_NAME, BT.TICKET_GATE_NAME,
                   DECODE(BR.ARRIVE_PERIOD, NULL, NULL, 
                        DECODE(SIGN(60-BR.ARRIVE_PERIOD), 1, '', TRUNC(BR.ARRIVE_PERIOD/60) || '小时') ||
                        DECODE(SIGN(MOD(BR.ARRIVE_PERIOD, 60)), 1, MOD(BR.ARRIVE_PERIOD, 60) || '分')) ARRIVE_PERIODSTR, 
                   VB.BUS_ID, VB.LICENSE_ID, VB.BC_BUSGRADE_ID, VB.BC_BUSTYPE_ID, 
                   VB.CARRIER_NAME, VB.QUALITY_SUM, NVL(VB.UNSALED_SEAT,0) AS UNSALED_SEAT,
                   T1.END_STATION_ID stationPrint, T1.full_COUNT,T1.half_COUNT,T2.PRICE_FULL,T2.Price_Semi
            FROM   BOS_RTORDER_ET BR
            left outer JOIN (SELECT END_STATION_ID,RTORDER_ID,
                        SUM(DECODE(Ticket_Type, '24001', 1, 0)) full_COUNT,
                         SUM(DECODE(Ticket_Type, '24002', 1, 0)) half_COUNT
                         FROM (select END_STATION_ID,Ticket_Type,RTORDER_ID
                          from STS_TICKET_ET
                         where TICKET_STATUS = '22001'
                         and Is_Check = '1'
                         union all
                 select END_STATION_ID,Ticket_Type,RTORDER_ID
                     from STS_TICKET_OTHER_ET
                         where  IS_CHECK = '1'
                          )
              GROUP BY END_STATION_ID,RTORDER_ID) T1 on BR.RTORDER_ID = T1.RTORDER_ID
left  join  sts_rtorder_price_et T2 
             on T1.END_STATION_ID =T2.station_id and T2.RTORDER_ID=BR.RTORDER_ID
            INNER JOIN BOS_LINE_ET BL ON BL.LINE_ID = BR.LINE_ID
            INNER JOIN BOS_TICKET_GATE_ET BT ON BT.TICKET_GATE_ID = BR.TICKET_GATE_ID
            LEFT JOIN BOS_STATION_ET BSB ON BSB.STATION_ID = BL.BEGIN_STATION_ID
            LEFT JOIN BOS_STATION_ET BSE ON BSE.STATION_ID = BL.END_STATION_ID
            LEFT JOIN BOS_PASSAGE_ET BP ON BP.PASSAGE_ID = BT.PASSAGE_ID
            INNER JOIN BOS_RTORDBUS_VIEW VB ON VB.RTORDER_ID = BR.RTORDER_ID
            LEFT JOIN BOS_ORDER_ET BO ON BO.ORDER_ID = BR.ORDER_ID
        <![CDATA[
          WHERE  BR.RTORDER_ID=#rtorderId#
        ]]>
       )
    </select>


最后解决如下:
查询sql中 
        <![CDATA[
          WHERE  BR.RTORDER_ID=#rtorderId#
        ]]>
并没有特殊字符,不需要用‘<![CDATA[’ 和‘ ]]>’包裹。

删掉‘<![CDATA[’ 和‘ ]]>’后问题解决。但依然不明其中道理。

我就在想,这会不会是ibatis的一个bug呢,有时候画蛇添足并不是件好事。

你可能感兴趣的:(oracle,sql,ibatis,jdbc,vb)