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 | |
2 | 1.1.1.1 |
select *, coalesceEmpty(destIP, '192.68.23.1') as newDestIP from table
Output
id | destIP | newDestIP | |
---|---|---|---|
1 | 192.68.23.1 | ||
2 | 1.1.1.1 | 1.1.1.1 |
Updated 12 months ago