当前位置: 代码迷 >> Java Web开发 >> ibatis动态配置信息-java.sql.SQLException: ORA-00933: SQL command not properly ended
  详细解决方案

ibatis动态配置信息-java.sql.SQLException: ORA-00933: SQL command not properly ended

热度:1181   发布时间:2016-04-17 00:43:51.0
ibatis动态配置信息--java.sql.SQLException: ORA-00933: SQL command not properly ended
我需要动态配置一些信息为SQL:详细内容如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap  
  PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"  
  "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap >

<typeAlias alias="markerPage" type="com.richfit.bi.imap.objects.MarkerPage" />

<sql id="condition"> 
 
<isNotEmpty property="name"> 
<![CDATA[ 
name LIKE '%'||#name# 
]]> 
</isNotEmpty> 
<isNotEmpty property="markerClassId"> 
<![CDATA[ 
AND MARKER_CLASS_ID = #markerClassId# 
]]> 

</isNotEmpty>
</sql> 

<select id="countMarkerRecords" resultClass="int" parameterClass="markerPage">
<![CDATA[
select COUNT(1) from imap_marker where MARKER_TYPE='1'
<dynamic prepend=" AND"> 
<include refid="condition" /> 
</dynamic>
]]>
</select>

</sqlMap>
运行时报异常java.sql.SQLException: ORA-00933: SQL command not properly ended,请高人指点....

------解决方案--------------------
name LIKE '%$name$'
------解决方案--------------------
试试这样吧
<dynamic >
<include refid="condition" />
</dynamic> 


<isNotEmpty property="name" prepend="and">
  

------解决方案--------------------
你的sql语句有问题 最好是能把sql语句放在数据库里泡一下
你这里<dynamic prepend=" AND"> AND后面注意要有空格
------解决方案--------------------
探讨
谢谢大家关注,但还是不行,我改成了这样也不行
<select id="countMarkerRecords" resultClass="int" parameterClass="markerPage">
<![CDATA[
select COUNT(1) from imap_marker where MARKER_TYPE='1'
<dynamic>
<isNotNull prepe……
  相关解决方案