oracle查询一个字段为空取另一个字段的数据
时间: 2024-02-26 14:58:30 浏览: 207
可以使用 COALESCE 函数来实现。COALESCE 函数返回参数列表中第一个非 NULL 的表达式的值。例如,如果你想要查询表中的字段 "field1",如果它为空则取 "field2" 的值,可以使用以下 SQL 语句:
```
SELECT COALESCE(field1, field2) FROM your_table;
```
这将返回 "field1" 的值,如果它为空,则返回 "field2" 的值。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![text/plain](https://img-home.csdnimg.cn/images/20250102104920.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![text/plain](https://img-home.csdnimg.cn/images/20250102104920.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![text/plain](https://img-home.csdnimg.cn/images/20250102104920.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)