REPLACE (array)

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:

  • arrayArray of fractional numbers | Array of integers | Array of strings
  • oldFractional number | Integer | String
  • newFractional 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.

Previous
Next