jdbcderbyjavadb

Case insensitive search in Java DB (Derby)


I'm using Derby and I can't find a way to do case insensitive search.

For example, I have a table that I'm searching that contains "Hello" but I put a search query in for "hello" and at the moment I won't get a result, but I want to.

I can't find the correct syntax for it.

Sara


Solution

  • 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')