oracle DECODE
时间: 2023-10-17 20:25:30 浏览: 103
oracle decode
DECODE is a function in Oracle that allows you to perform conditional logic in SQL queries. It takes multiple arguments and compares the first argument with the subsequent pairs of arguments. If the first argument matches any of the subsequent arguments, it returns the corresponding value.
Here's the syntax for the DECODE function:
```
DECODE(expression, search1, result1, search2, result2, ..., default)
```
- `expression` is the value you want to compare.
- `search1`, `search2`, etc. are the values to compare against.
- `result1`, `result2`, etc. are the values to return if the corresponding search value matches the expression.
- `default` (optional) is the value to return if none of the search values match the expression. If omitted, NULL is returned.
阅读全文