translate vs replace : REPLACE « Character String Functions « Oracle PL/SQL Tutorial






SQL>
SQL> select translate('beer bucket','beer','milk') as translate
  2  ,      replace  ('beer bucket','beer','milk') as replace_1
  3  ,      replace  ('beer bucket','beer')        as replace_2
  4  from   dual;

TRANSLATE   REPLACE_1   REPLACE
----------- ----------- -------
miik muckit milk bucket  bucket

SQL>








11.16.REPLACE
11.16.1.The REPLACE Function
11.16.2.If the look for string is not present, then the replacing does not occur
11.16.3.REPLACE(x, search_string, replace_string) searches x for search_string and replace it with replace_string.
11.16.4.select replace ('beer bucket','beer','milk') as replace_1
11.16.5.select replace ('beer bucket','beer') as replace_2
11.16.6.translate vs replace