coalesceEmpty

Apply a specified value to empty cells.

Apply a specified value to empty cells in a specified table column. If a cell has a value, the same value is returned.

Usage Details

select *, coalesceEmpty(column, param) as returnValue from tableName

-- column: column name to check if it is empty
-- param: if column is empty return param value
-- tableName: name of a table

-- returnValue: if column value is not empty columns value is returned, otherwise param value will be returned

Example

Input
table

id destIP
1
21.1.1.1
select *, coalesceEmpty(destIP, '192.68.23.1') as newDestIP from table

Output

id destIP newDestIP
1192.68.23.1
21.1.1.11.1.1.1

Did this page help you?