---
agentTools:
  projectIndex: https://help.logichub.com/llms.txt
---

# 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.

[block:api-header]
{
  "type": "basic",
  "title": "Usage Details"
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "select *, coalesceEmpty(column, param) as returnValue from tableName\n\n-- column: column name to check if it is empty\n-- param: if column is empty return param value\n-- tableName: name of a table\n\n-- returnValue: if column value is not empty columns value is returned, otherwise param value will be returned",
      "language": "sql",
      "name": "LQL Command"
    }
  ]
}
[/block]

[block:api-header]
{
  "title": "Example"
}
[/block]

**Input**
table

[block:html]
{
  "html": "<style>\n  th {\n    border: 1px solid #cccccc;\n    background-color: #eeeeee;\n    padding: 8px 5px 8px 5px;\n    text-align: left\n  }\n</style>\n\n<div><table>\n<thead>\n<tr>\n<th>id</th>\n<th>destIP</th>\n</tr>\n</thead>\n<tbody>\n\t<tr><td>1</td><td></td></tr>\n  <tr><td>2</td><td>1.1.1.1</td></tr>\n</tbody>\n</tr>\n</table></div>"
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "select *, coalesceEmpty(destIP, '192.68.23.1') as newDestIP from table",
      "language": "sql",
      "name": "LQL command"
    }
  ]
}
[/block]

**Output**

[block:html]
{
  "html": "<div><table>\n<thead>\n<tr>\n<th>id</th>\n<th>destIP</th>\n  <th>newDestIP<th>\n</tr>\n</thead>\n<tbody>\n\t<tr><td>1</td><td></td><td>192.68.23.1</tr>\n  <tr><td>2</td><td>1.1.1.1</td><td>1.1.1.1</td></tr>\n</tbody>\n</tr>\n</table></div>\n\n"
}
[/block]