Neoview SQL Reference Manual (R2.4 SP2)
REPLACE Function
The REPLACE function returns a character string where all occurrences of a specified character
string in the original string are replaced with another character string. All three character value
expressions must be comparable types and must use the same character set. The return value is
the VARCHAR type.
REPLACE is a Neoview SQL extension.
REPLACE (char-expr-1, char-expr-2, char-expr-3)
char-expr-1, char-expr-2, char-expr-3
are SQL character value expressions. The operands are the result of evaluating the character
expressions. All occurrences of char-expr-2 in char-expr-1 are replaced by
char-expr-3. See “Character Value Expressions” (page 243).
Example of REPLACE
• Use the REPLACE function to change job descriptions so that occurrences of the company
name are updated:
SELECT jobdesc FROM persnl.job;
Job Description
------------------
MANAGER COMNET
PRODUCTION COMNET
ASSEMBLER COMNET
SALESREP COMNET
SYSTEM ANAL COMNET
...
--- 10 row(s) selected.
UPDATE persnl.job
SET jobdesc = REPLACE (jobdesc, 'COMNET', 'TDMNET');
Job Description
------------------
MANAGER TDMNET
PRODUCTION TDMNET
ASSEMBLER TDMNET
SALESREP TDMNET
SYSTEM ANAL TDMNET
...
--- 10 row(s) selected.
436 SQL Functions and Expressions