Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: replace substring
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
-- Have a nice day Michel Svein Fossdal <sveifo_at_frisurf.no> a écrit dans le message : mfwW4.10645$C9.190172_at_news1.online.no...Received on Tue May 23 2000 - 00:00:00 CDT
> 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
>
>
![]() |
![]() |