APPX Software Library

Chapter 4: SQL Language Elements

4.9.2.65 REPLACE function (ODBC compatible)

Syntax

REPLACE ( string_exp1,string_exp2,string_exp3 )

Description

The scalar function REPLACE replaces all occurrences of string_exp2 in string_exp1 with string_exp3.

Example

SELECT REPLACE ( name,'mi','moo' )
FROM customer
WHERE name = 'Smith';

REPLACE(NAME,MI,MOO)

Smooth
1 record selected

Notes

  • string_exp can be of the type fixed or variable length CHARACTER.
  • If any of the arguments of the expression evaluates to null, the result is null.
  • If the replacement string is not found in the search string, it returns the original string.