I want to remove the case sensitivity from emails when searching emails.
For further explanation, If I search an email([email protected]
) in a different ways like this '[email protected]'
or '[email protected]'
or '[email protected]'
. I want to retrieve the email. If anyone can help, really appreciated.
Thank you
As pointed out in the comments, this email lookup operation is actually done by querying an Oracle database.
In this case I would suggest to investigate whether it is possible to execute a query containing a case insensitive WHERE
clause to filter on the Email
column. I'm not an oracle db expert, but usually database systems allow to perform case insensitive queries, by using the proper collation. At least checkig if this is actually allowed is worth the effort.
By doing so you will get the following advantages:
Another option you can consider, if running a case insensitive query is not supported by your database, is storing the email in a normalized form. You can save both the actual email value (with the original casing) and a normalized version of the email (for instance you can use the email value transformed in uppercase). Then, to perform case insensitive search, you can use the column containing the normalized email value in your WHERE
clause. I would suggest to use this approach as a last resort, because you will increase the amount of data stored and you will make your queries less obvious: this is just a workaround to apply when case insensitive queries are not possible.