Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: July 28, 2016 - 12:50 pm UTC

Last updated: July 28, 2016 - 8:27 pm UTC

Version: 11.0

Viewed 1000+ times

You Asked

Sir can you help me regarding this query in SQL by using character functions only....

I/P : ABC DEF GHI

Output: ADG

and Chris said...

Here's one way:

- Use initcap to lowercase all the characters except the first of each word
- Replace all the lowercases characters and space with null:

with rws as (
  select 'ABC DEF GHI' s from dual
)
  select regexp_replace(initcap(s), '([[:lower:]]| )') 
  from rws;

REGEXP_REPLACE(INITCAP(S),'([[:LOWER:]]|)')  
ADG   

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, June 22, 2019 - 5:26 am UTC

1no

A reader, June 22, 2019 - 5:26 am UTC

1no

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library