Syntax: REPLACE (char, search_string, replacement_string) usage: Convert all string search_string in char to string replacement_stri
Syntax: REPLACE (char, search_string, replacement_string) usage: Convert all string search_string in char to string replacement_stri
Syntax: REPLACE (char, search_string, replacement_string)
Usage: convert all the string search_string in char to the string replacement_string without matching strings.
Example:
SQL> select REPLACE ('fgsgswsgs ', 'fk', 'J') from dual; return value from dual;
The result is fgsgswsgs.
SQL> select REPLACE ('fgsgswsgs ', 'sg', 'eeerrrttt') return value from dual;
The result is fgeeerrrtttsweeerrrttts.
Analysis: In the first example, because 'fgsgswsgs 'does not have a matching string with 'fk', the returned value is still 'fgsgswsgs ';
In the second example, convert all the strings 'sg 'in 'fgsgswsgs' to 'eeerrrttt '.
Conclusion: replace and translate are both substitution functions, but replace is for strings, while translate is for a single character.