Right now I'm writing a java program that is an API to run queries on an SQL database. There is a search API call which compares the parameters to several fields and it changes the parameters to lower case and the data to lowercase when comparing so there is no issues. For example
SELECT
...
FROM
...
WHERE
LOWER( position.positionname ) = parameters;
This part is working, however, there is one data type that I am having trouble comparing because it is an ENUM datatype called location. Here is the SQL.
CREATE TYPE location AS ENUM
(
'New York', 'Los Angeles', 'Chicago',
'London','Paris','Tokyo'
);
I can't use the lower()
function on it because it is not a string. Someone searching for New York
on our application may not necessarily capitalize the correct letters but we still want the application to work. Is there a way to convert enum to string and then lower() it all within the SQL query?