今天遇到了这个问题,记录一下,在模糊查询中出现报错:
java.sql.SQLSyntaxErrorException: ORA-00909: 参数个数无效
出现原因在concat上:
concat是连接两个字符串的函数,这里连接了三个,把SQL改成两个concat嵌套的
select *
from D_EBC_COMPANY_APPLY
where audit_flag='0'
<if test="companyId !=null and companyId !=''">
or c.company_id like concat(concat('%',#{companyId}),'%')
</if>
<if test="companyName !=null and companyName !=''">
or company_name like concat(concat('%',#{companyName}),'%')
</if>
<if test="manageScope !=null and manageScope !=''">
and manage_scope=#{manageScope}
</if>