fbpx

Difference between REPLACE and TRANSLATE in SQL?

VijayaTech Labs Blog
Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
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

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on skype
Share on telegram
Share on whatsapp
Share on email

Leave a Comment

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

Scroll to Top