Difference between REPLACE and TRANSLATE in SQL?

VijayaTech Labs Blog
Replace will replace the character or string with the given character/string for every occurrence of the character/string.
Translate will replace the character with another character given not by the string/multiple characters

Case 1:

SELECT
REPLACE(‘Jack and Jue’,’J’,’Bl’) replace_str,
TRANSLATE(‘Jack and Jue’,’J’,’Bl’) translate_str
FROM DUAL;

Case 2:

SELECT
REPLACE(‘Jack and Jue’,’J’,”) replace_str,
TRANSLATE(‘Jack and Jue’,’J’,”) translate_str
FROM DUAL;

Share this post with your friends

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top