不区分大小写的查询
我有一些票号可能混合有数字和字母。我将把 ticketNumberIds
传递到此方法(用户输入)中,我希望它对 Oracle 数据库进行查询,并让查询获取大小写不同的票证。
如何使以下查询不区分大小写?
public List<TicketDO> getTicketDOsById(final List<String> ticketNumberIds) {
String myQuery = "from TicketDO t where t.ticketNumberId in (:ticketNumberIds)";
return getEntityManager().createQuery(myQuery).setParameter("ticketNumberIds", ticketNumberIds)
.getResultList();
}
I have some ticket numbers that may have numbers and letters mixed. I'll be passing in the ticketNumberIds
into this method (user input) and I want it to query against the Oracle database and have the query pick up tickets that differ by upper and lower cases.
How do I make the following a case-insensitive query?
public List<TicketDO> getTicketDOsById(final List<String> ticketNumberIds) {
String myQuery = "from TicketDO t where t.ticketNumberId in (:ticketNumberIds)";
return getEntityManager().createQuery(myQuery).setParameter("ticketNumberIds", ticketNumberIds)
.getResultList();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 UPPER 执行不区分大小写的查询。
You can use UPPER to perform case insensitive queries.