TRANSLATE
- This will replace the set of characters, character by character.
- To replace the single character at a time.
Syntax: translate (string, old_chars, new_chars)
Ex:
select translate('india','in','xy') from dual;
output
translate('india','in','xy')
------------------------------
xydxa

some more example
select translate('india','in','xy') from dual;
---------------------------------------------------
xydxa
select translate('1oraclesql23','123','456') from dual;
---------------------------------------------------
4oraclesql56
select translate('222oraclesql','2cl','333') from dual;
---------------------------------------------------
333ora33esq3
in case of NULL
select translate('ABCD','AB','NULL') from dual;
---------------------------------------------------
NUCD
select translate('ABCD','AB',NULL) from dual;
---------------------------------------------------
null