Re: Substitute Characters in SQL

From: William Nunn <nunnw_at_bcstec.ca.boeing.com>
Date: Wed, 22 Mar 1995 17:14:42 GMT
Message-ID: <D5uqKJ.65I_at_bcstec.ca.boeing.com>


Stefan Scheck (scheck_at_ask.uni-karlsruhe.de) wrote:
: I have a special problem concerning a SELECT-Statement.
 

: I need a SQL-Funktion (just like Translate) which replaces
: the occurance of all characters c1 in a String by a corresponding
: string s1.
: Unfortunately Translate is a funktion for Character-Substitution,
: not for String-Substitution.
 

: Taht's what I want:
 

: Example: SELECT F('EXAMPLE') FROM DUAL;
 

: Result : xyzXAMPLxyz
 

: The Funktion F should be able to substitute all 'E's with 'xyz'.
 

: I cannot use PL/SQL, because I want to create a View with such a
: SQL-Statement.
 

: If someone has a solution for this problem, please let me know.
 

: Stefan Scheck
: E-Mail: scheck_at_ask.uni-karlsruhe.de

select REPLACE('example','e','xyz') from dual;

returns:

REPLACE('EX



xyzxamplxyz Received on Wed Mar 22 1995 - 18:14:42 CET

Original text of this message