4

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?

snakile
  • 50,186
  • 60
  • 164
  • 235

1 Answers1

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
Community
  • 1
  • 1
Richard
  • 28,666
  • 8
  • 72
  • 117