replace
function
Applies to: Databricks SQL
Databricks Runtime
Replaces all occurrences of search
with replace
.
replace(str, search [, replace] )
str
: ASTRING
expression to be searched.search
: ASTRING
expression to be replaced.replace
: An optionalSTRING
expression to replacesearch
with. The default is an empty string.
A STRING
.
If you do not specify replace
or is an empty string, nothing replaces the string that is removed from str
.
> SELECT replace('ABCabc', 'abc', 'DEF');
ABCDEF
> SELECT replace('ABCabc' COLLATE UTF8_LCASE, 'abc', 'DEF');
DEFDEF