REPLACE (array)
Written by
Updated at June 27, 2023
Function REPLACE
is also found in the following categories: String functions.
Syntax
REPLACE( array, old, new )
Description
Replaces each array
element equal to old
with new
.
Argument types:
array
—Array of fractional numbers | Array of integers | Array of strings
old
—Fractional number | Integer | String
new
—Fractional number | Integer | String
Return type: Same type as (array
)
Example
[array] | REPLACE([array], 300, -1) | REPLACE([array], NULL, 0) |
---|---|---|
'[100,300,200,100,300]' |
'[100,-1,200,100,-1]' |
'[100,300,200,100,300]' |
'[100,300,NULL,NULL]' |
'[100,-1,NULL,NULL]' |
'[100,300,0,0]' |
'[150,NULL,130,192]' |
'[150,NULL,130,192]' |
'[150,0,130,192]' |
Data source support
ClickHouse 21.8
, PostgreSQL 9.3
.