我需要动态配置一些信息为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后面注意要有空格
------解决方案--------------------