skip to Main Content

I’ve got a simple table, primary key and name.
The string always starts with a capital letter but could have more capital letters than just the first character. I want to return all the uppercase characters in the name.

select
    (select substring(name, '([A-Z])') name)
from cust

This returns just the first capital letter. How can I achieve this?

2

Answers


  1. This statement will return all the Capital Letters in a particular column.

    select upper(column_name) from table_name;

    Login or Signup to reply.
  2. You may use a regex replacement on the name to remove any character which is not an uppercase letter:

    SELECT name, REGEXP_REPLACE(name, '[^A-Z]+', '', 'g') AS caps
    FROM cust;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search