岁月如灬风
2019-09-04 11:45
采纳率: 76.9%
浏览 1.1k
已采纳

ORA-00921: 未预期的 SQL 命令结尾,帮忙看一下这个语句哪里错了?

报错如下
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred while applying a parameter map.  
--- Check the TpostUpexamreg.findTpostUpexamregDetailList-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: ORA-00921: 未预期的 SQL 命令结尾

语句如下:

<select id="findTpostUpexamregDetailList" parameterClass="map" resultClass="tpostUpexamregBean">
    select  
        upexam.year,upexam.currentgrade,upexam.id,
        upexam.targetgrade,upexam.flowsta,upexam.chksign,
        us.username username_,us.idcard,
        up.chgradeyear chgradeyear_,up.year year_,up.effstayear effstayear_,up.effendyear effendyear_,
        co.codename spostname_
    from 
        tb_tpost_upexamreg upexam,pxgl_users us,
        tb_tpost_userpost up,tb_tpost_code co,pxgl_unit un
    where 
        upexam.year = #year#
        <isNotEmpty property="unitid">
            and upexam.unitid = #unitid#
        </isNotEmpty>
        <!-- 不为被废弃数据 -->  
        and upexam.flowsta!=-99
        and upexam.idcard = us.idcard(+)
        and us.idcard= up.idcard(+)
        and us.unitid = un.unitid(+)
        and up.dataflag!=99
        <isNotEmpty prepend="and" property="flowsta">
            <isEmpty property="flowsta21">
                <![CDATA[upexam.flowsta >= #flowsta#]]>
            </isEmpty>
            <isNotEmpty property="flowsta21">
                (<![CDATA[upexam.flowsta >= #flowsta#]]> or upexam.flowsta=#flowsta21#)
            </isNotEmpty>
            <isEqual compareValue="21" property="flowsta" prepend="and">
                un.f_unitid is not null
            </isEqual>
        </isNotEmpty>
        and upexam.mpostid = up.mpostid 
        and upexam.spostid = up.spostid
        and up.spostid = co.id
    <isNotEmpty prepend="" property="mpostid">
        and upexam.mpostid = #mpostid#
        <isNotEmpty property="spostid">
            and upexam.spostid = #spostid#
        </isNotEmpty>   
    </isNotEmpty>
    <isNotEmpty property="targetGrade">
        and upexam.targetgrade = #targetGrade#
    </isNotEmpty>   
    <isNotEmpty prepend="and" property="keyword">
        us.username like '%'||#keyword#||'%'
    </isNotEmpty>
    <isNotEmpty prepend="and" property="filterChk">
        upexam.flowsta != 99
    </isNotEmpty>
    <!-- <isNotEmpty property="sortfield"> -->
        order by upexam.flowsta
    <!-- </isNotEmpty> -->
</select>
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • Tiarnach 2019-09-04 11:55
    已采纳

    '%'||#keyword#||'%' 这个字符串不对,要匹配内部'要转以,where里少4个and

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题