Skip to main content

REPLACE

Searches the string for a substring and replaces it with a replacement.

Syntax

REPLACE ( string_expression, substring, replacement ) 

Arguments

string_expression
A valid string expression.

substring A string expression that if contained in string_expression will be replaced.

replacement A string expression to be used to replaced instances of substring in string_expression.

Return Type

Returns values of type STRING.

Examples

Examples in this section use the example blockchain.

The following example replaces all instances of "d" in the str column with "b".

SELECT REPLACE(str, "d", "b") FROM example;

Response:

REPLACE(str, "d", "b") [STRING]
NULL
b
lect
bialect