oracle replace null
时间: 2023-08-24 19:13:48 浏览: 94
oracle 多个字符替换实现
In Oracle, you can use the `NVL` function to replace a null value with a specified value. The syntax of the `NVL` function is as follows:
```
NVL(expr1, expr2)
```
If `expr1` is null, then `expr2` is returned; otherwise, `expr1` is returned. Here's an example:
```sql
SELECT NVL(column_name, 'replacement_value')
FROM table_name;
```
In the above example, if `column_name` is null, it will be replaced with the `'replacement_value'`.
Alternatively, you can use the `COALESCE` function in Oracle to achieve the same result. The syntax is similar:
```sql
SELECT COALESCE(column_name, 'replacement_value')
FROM table_name;
```
Both `NVL` and `COALESCE` functions can be used to handle null values in Oracle.
阅读全文