在我%在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(?)這引發(fā)了一個錯誤(從 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條經(jīng)驗 獲得超9個贊
梅伯使用CONCAT函數(shù)你可以解決你的答案。
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
提交
取消