I have a table with an email address column. Some email addresses in the table contain uppercase letters. I would like to fetch all the rows with uppercase emails (in order to set them to lowercase). How do I select all the rows where the email address contains uppercase letters?
Asked
Active
Viewed 1,256 times
1 Answers
5
I believe Oracle is case sensitive by default? If so, then this should work:
SELECT *
FROM table_name
WHERE LOWER(email) <> email
If this works then you can simply update them with
UPDATE table_name
SET email = LOWER(email)
WHERE LOWER(email) <> email
-
Damn, you were a minute faster :P – d33tah Nov 05 '12 at 10:31
-
1@d33tah - a minute is too long time between answers here in SO :P – Mahmoud Gamal Nov 05 '12 at 10:33