Introduction

The REPLACE function allows you to transform text by using the specified pattern shown here:

v_tx:= replace(string,search[,replacement]);

The REPLACE function changes one string to another string, as shown here:

If you don't specify the third parameter, Oracle removes all occurrences of the search string.

Demo

SQL>
SQL> declare--  www  .  j a  va 2 s.  c o m
  2      v1_tx VARCHAR2(20):='To be or not to be';
  3      v2_tx VARCHAR2(20);
  4  begin
  5      DBMS_OUTPUT.put_line('Before: ' || v1_tx);
  6      v2_tx:= replace (v1_tx,'be','eat');
  7      DBMS_OUTPUT.put_line('After: ' || v2_tx);
  8  end;
  9  /
Before: To be or not to be
After: To eat or not to eat

PL/SQL procedure successfully completed.

SQL>

Related Topic