This article is written about how to use the Oracle/PLSQL TRANSLATE feature with syntax and examples.
The Oracle/PLSQL TRANSLATE function replaces a sequence of characters in a string with another set of characters. However, it replaces a single character at a time.
For example, it will exchange the 1st persona in the string_to_replace with the 1st persona in the replacement_string. Then it will replace the 2nd persona in the string_to_replace with the 2nd character in the replacement_string, and so on.
The syntax for the TRANSLATE function in Oracle/PLSQL is:
TRANSLATE( string1, string_to_replace, replacement_string )
Parameters or Arguments
string1 The string to substitute a sequence of characters with any other set of characters. string_to_replace The string that will be searched for in string1. replacement_string All characters in the string_to_replace will be changed with the corresponding persona in the replacement_string.
The TRANSLATE function returns a string value.
The TRANSLATE characteristic can be used in the following versions of Oracle/PLSQL:
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
Let’s seem to be at some Oracle TRANSLATE characteristic examples and explore how to use the TRANSLATE feature in Oracle/PLSQL.
TRANSLATE('1tech23', '123', '456') Result: '4tech56' TRANSLATE('222tech', '2ec', '3it') Result: '333tith'