How can I replace a particular special character with another character?
Ex in same query I want to replace à with a and è with e. Both in same query.
If I use replace simply it doesn't work in sql developer.
CodePudding user response:
The REPLACE
function can do this:
SELECT REPLACE( 'I want to replace à with a', 'à', 'a') FROM DUAL;
CodePudding user response:
Just try one of these ways:
- Solution 1:
SELECT REPLACE( REPLACE('I want to replace à with a and è with e', 'à', 'a'),'è', 'e') FROM DUAL;
- Solution 2:
SELECT translate('I want to replace à with a and è with e', 'àè', 'ae') FROM DUAL;
the second looks like better.
I use Oracle 12C release 2.
CodePudding user response:
You can achieve this using TRANSLATE() function: enter image description here