Reputation: 33
I have an Employees table where I have columns such as last_name
first_name
,salary
, etc.. I want to write a query which will replace
for each last_name
in the Employees table. Basically there are two ways to do it
translate: if I use this I am missing out either on lower case or upper case matching,e.g. translate(last_name,[skae],[kaes])
regexp_replace: I tried this, but from second replacement it is replacing the character with null. regexp_replace(last_name,'[(s|S)(k|K)(a|A)(e|E)]',[KAES],1,0,'i']
Upvotes: 0
Views: 47
Reputation: 1269973
Use translate()
for single character replacement:
select translate(last_name, 'SsKkAaEs', 'KKAAEESS')
Upvotes: 3