Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Use REGEXP_REPLACE as advanced initcap function?

haavardFeb 27 2008 — edited Jul 21 2008

Hi,

I wan't to convert a string "bygger'n" to "Bygger'n", is it possible to do something like this with regexp_replace?

"bygger'n" is just meant as an example, I want to replace all matching patterns with lowercase letters.

Oracle does not seem to consider lower/upper-functions for the replace of patterns:

SQL> select regexp_replace(initcap('bygger''n'), '(''[[:alnum:]])', lower('\1')) try_lower
  2  ,      regexp_replace(initcap('bygger''n'), '(''[[:alnum:]])', ' \1 ') spaces
  3  from   dual
  4  /

TRY_LOWE SPACES
-------- ----------
Bygger'N Bygger 'N

Regards
Haavard

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2008
Added on Feb 27 2008
35 comments
22,869 views