Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: replace substring

Re: replace substring

From: Michel Cadot <micadot_at_netcourrier.com>
Date: 2000/05/23
Message-ID: <8ge4hu$40p$1@news2.isdnet.net>#1/1

What about the replace function of SQL?

REPLACE
Syntax REPLACE(char, search_string[,replacement_string])

Purpose

Returns char with every occurrence of search_string replaced with replacement_string. If replacement_string is omitted or null, all occurrences of search_string are removed. If search_string is null, char is returned. This function provides a superset of the functionality provided by the TRANSLATE function. TRANSLATE provides single character, one to one, substitution. REPLACE allows you to substitute one string for another as well as to remove character strings.

Example

SELECT REPLACE('JACK and JUE','J','BL') "Changes"  FROM DUAL Changes



BLACK and BLUE
--
Have a nice day
Michel


Svein Fossdal <sveifo_at_frisurf.no> a écrit dans le message : mfwW4.10645$C9.190172_at_news1.online.no...

> Hello
>
> Does anybody have a good function or procedure that
> finds every occurence of a given substring and changes
> this to a new one?
> A typical function call would be something like
> search_and_replace('old_substring', 'new_substring', column, table)
>
> I am very greatful for any help.
>
> Regards
> Svein Fossdal
>
>
Received on Tue May 23 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US