joseph aziz
joseph aziz

Reputation: 1

Replace letter before space oracle

I have different strings and I need to change a specific character if its at the end of each word For example input string 'atyu auds aseu udae' to be 'aty* auds ase* udae' it will replace letter u only if it was last digit need it in oracle sql

Upvotes: 0

Views: 42

Answers (1)

Littlefoot
Littlefoot

Reputation: 142743

One option is to use regular expression, such as

SQL> with test (col) as
  2    (select 'atyu auds aseu udaeu' from dual)
  3  select trim(regexp_replace(col, 'u |u$', '* ')) result
  4  from test;

RESULT
--------------------
aty* auds ase* udae*

SQL>

Upvotes: 1

Related Questions