在我%在LIKE子句中使用通配符之前,我遇到的查询工作正常。:-这很好(从 Java 打印):-select acc.*, service.* from com_accounts acc left join com_subscriptions service on acc.cust_id = service.cust_id where 1=1 and UPPER(acc.first_name) LIKE UPPER(?)这引发了一个错误(从 Java 代码打印):-select acc.*, service.* from com_accounts acc left join com_subscriptions service on acc.cust_id = service.cust_id where 1=1 and UPPER(acc.first_name) LIKE UPPER('%'?'%')java.sql.SQLSyntaxErrorException: ORA-00907: 缺少右括号
2 回答
PIPIONE
TA贡献1829条经验 获得超9个赞
梅伯使用CONCAT函数你可以解决你的答案。
select acc.*, service.*
from com_accounts acc
left join com_subscriptions service on acc.cust_id = service.cust_id
where 1=1 and UPPER(acc.first_name) LIKE UPPER(CONCAT('%',?,'%'))
添加回答
举报
0/150
提交
取消