Replace+function+Oracle

https://sqlandplsql.com/2012/09/24/replace-function-oracle/

=Replace function Oracle =  [|September 24, 2012]  [|sqlandplsql]   [|Oracle]   [|how to replace string], [|Replace function Oracle] , [|Replace function PL/SQL] , [|Replace function sql] , [|replace syntax oracle] Replace function replaces the string with another string if it matches. It is a character function in Oracle. Replace function is case-sensitive. Syntax:- REPLACE(‘input string’,’find_string’,’replace_string’); Example:- 1. Below query replaced ‘sql’ with ‘sequel’ SQL> select replace(‘sqlandplsql’,’sql’,’sequel’) as replace_string from dual; REPLACE_STRING

—————–

sequelandplsequel 2. If no match it will return same string SQL> select replace(‘sqlandplsql’,’abc’,’sequel’) as replace_string from dual; <span style="background-color: rgba(255,255,255,0);">REPLACE_STRING

<span style="background-color: rgba(255,255,255,0);">———–

<span style="background-color: rgba(255,255,255,0);">sqlandplsql <span style="background-color: rgba(255,255,255,0);">3. If you omit the replace_string, replace function removes the string. <span style="background-color: rgba(255,255,255,0);">SQL> select replace(‘sqlandplsql’,’sql’) as replace_string from dual; <span style="background-color: rgba(255,255,255,0);">REPLACE_STRING

<span style="background-color: rgba(255,255,255,0);">—–

<span style="background-color: rgba(255,255,255,0);">andpl <span style="background-color: rgba(255,255,255,0);">4. Replace function can directly use in PL/SQL <span style="background-color: rgba(255,255,255,0);">begin

<span style="background-color: rgba(255,255,255,0);">dbms_output.put_line(replace(‘sqlandplsql’,’sql’,’sequel’));

<span style="background-color: rgba(255,255,255,0);">end; <span style="background-color: rgba(255,255,255,0);">Also read : [|Translate function] <span style="background-color: rgba(255,255,255,0); display: block; text-align: left;"> [|About these ads] ===<span style="background-color: rgba(255,255,255,0);">Share this: ===
 * Twitter
 * Facebook
 * Google