> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# coalesce

> 从左向右返回参数中第一个非 NULL 表达式。

从左向右返回参数中的第一个非 NULL 表达式。

## 语法

```Haskell theme={null}
coalesce(expr1,...);
```

## 参数说明

`expr1`: 表达式必须在数据类型上能够兼容，否则返回报错。

## 返回值说明

返回值的数据类型与 `expr1` 类型一致。

## 示例

```Plain Text theme={null}
mysql> select coalesce(3,NULL,1,1);
+-------------------------+
| coalesce(3, NULL, 1, 1) |
+-------------------------+
|                       3 |
+-------------------------+

mysql> select coalesce(NULL,2,1,1);
+-------------------------+
| coalesce(NULL, 2, 1, 1) |
+-------------------------+
|                       2 |
+-------------------------+
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.