我将参数设置成 bizCode=”””BIZ-NATIONAL-SOUTUDI””,””BIZ-NATIONAL-DEFUALT”””;
在ibatis里面<select id=”queryListTblBcsShare” parameterType=”com.ums.bcs.front.model.Share” resultMap=”ShareResultMap”>
select BIZ_ID,
BIZ_CODE,
DETAIL_ID,
IS_CUS_URL,
BIZ_CLIENT_VERSION,
BIZ_STATUS,
SHARE_URL,
SHARE_TYPE
from TBL_BCS_SHARE
where (BIZ_CODE in (${bizCode} $)
and SHARE_TYPE=#{shareType,jdbcType=VARCHAR})
or (BIZ_CODE is null
and SHARE_TYPE=#{shareType,jdbcType=VARCHAR})
or(BIZ_CODE=#{bizCode,jdbcType=VARCHAR}
and SHARE_TYPE is null)
or(BIZ_CODE is null and SHARE_TYPE is null)
order by BIZ_CODE nulls last,SHARE_TYPE nulls last
</select>
然后在控制台报错:
BIZ_CODE,
DETAIL_ID,
IS_CUS_URL,
BIZ_CLIENT_VERSION,
BIZ_STATUS,
SHARE_URL,
SHARE_TYPE
from TBL_BCS_SHARE
where (BIZ_CODE in (“”BIZ-NATIONAL-SOUTUDI””,””BIZ-NATIONAL-DEFUALT”” $)
and SHARE_TYPE=?)
or (BIZ_CODE is null
and SHARE_TYPE=?)
or(BIZ_CODE=?
and SHARE_TYPE is null)
or(BIZ_CODE is null and SHARE_TYPE is null)
order by BIZ_CODE nulls last,SHARE_TYPE nulls last
17:44:32.706 INFO [bio-8080-exec-3] c.h.c.m.i.p.DiclectStatementHandlerInterceptor – —-pra:com.ums.bcs.front.model.Share@bc3ed6
17:44:32.706 INFO [bio-8080-exec-3] c.h.c.m.i.p.DiclectStatementHandlerInterceptor – ———————————————————
17:44:32.846 INFO [bio-8080-exec-3] o.s.b.f.xml.XmlBeanDefinitionReader – Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
17:44:32.906 INFO [bio-8080-exec-3] o.s.j.support.SQLErrorCodesFactory – SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLException: ORA-00911: 无效字符
如果用 select BIZ_ID,
BIZ_CODE,
DETAIL_ID,
IS_CUS_URL,
BIZ_CLIENT_VERSION,
BIZ_STATUS,
SHARE_URL,
SHARE_TYPE
from TBL_BCS_SHARE
where (BIZ_CODE in (${bizCode})
and SHARE_TYPE=#{shareType,jdbcType=VARCHAR})
or (BIZ_CODE is null
and SHARE_TYPE=#{shareType,jdbcType=VARCHAR})
or(BIZ_CODE=#{bizCode,jdbcType=VARCHAR}
and SHARE_TYPE is null)
or(BIZ_CODE is null and SHARE_TYPE is null)
order by BIZ_CODE nulls last,SHARE_TYPE nulls last
这样就只有一个值了,
在控制台输出:
BIZ_CODE,
DETAIL_ID,
IS_CUS_URL,
BIZ_CLIENT_VERSION,
BIZ_STATUS,
SHARE_URL,
SHARE_TYPE
from TBL_BCS_SHARE
where (BIZ_CODE in (BIZ-NATIONAL-SOUTUDI)
and SHARE_TYPE=?)
or (BIZ_CODE is null
and SHARE_TYPE=?)
or(BIZ_CODE=?
and SHARE_TYPE is null)
or(BIZ_CODE is null and SHARE_TYPE is null)
order by BIZ_CODE nulls last,SHARE_TYPE nulls last
17:47:13.774 INFO [bio-8080-exec-3] c.h.c.m.i.p.DiclectStatementHandlerInterceptor – —-pra:com.ums.bcs.front.model.Share@129efd0
17:47:13.774 INFO [bio-8080-exec-3] c.h.c.m.i.p.DiclectStatementHandlerInterceptor – ———————————————————
17:47:13.824 INFO [bio-8080-exec-3] o.s.b.f.xml.XmlBeanDefinitionReader – Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
17:47:13.885 INFO [bio-8080-exec-3] o.s.j.support.SQLErrorCodesFactory – SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLException: ORA-00904: “SOUTUDI”: 标识符无效
### The error may involve com.ums.bcs.front.dao.ShareDao.queryListTblBcsShare-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: ORA-00904: “SOUTUDI”: 标识符无效
应该怎么写啊?求大神指教