Case insensitive search in Java DB (Derby)

北战南征 提交于 2019-12-05 07:42:47

You can use the UPPER() or LOWER() SQL functions on both your search argument and the field, like in

SELECT *
FROM   mytab
WHERE  UPPER(lastname) = UPPER('McDonalds')

The most common way to do this is to use generated columns. Here's a nice writeup from one of the Derby developers: http://blogs.oracle.com/kah/entry/derby_10_5_preview_generated

This is really a late answer which I am not sure is the best way to manage the the process of doing a case insensitive search on a Textarea in a Derby Database
We added our search results to a TableView so if you get two results returned then the user has at least the option to decide which result is of value.

    String upper = "BIG";
    String lower = "big";
    ResultSet rs = stmnt.executeQuery("SELECT * FROM Child WHERE cEntry LIKE 
    '"+"%"+upper+"%"+"'OR cEntry LIKE'"+"%"+lower+"%"+"'");
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!