orcl case when
时间: 2023-09-01 17:10:03 浏览: 88
CASE WHEN is a conditional expression in Oracle SQL that allows you to perform conditional logic within a query. It is used to evaluate a condition and return a specific value or perform certain actions based on the result.
Here's an example of how you can use CASE WHEN in Oracle SQL:
```sql
SELECT column_name,
CASE
WHEN condition1 THEN result1
WHEN condition2 THEN result2
ELSE result3
END AS alias_name
FROM table_name;
```
In this example, you specify the column_name you want to select from the table. Then, you use CASE WHEN to define the conditions and the corresponding results. The ELSE clause is optional and is used to specify a default result if none of the conditions are met.
Please let me know if you have any further questions!
阅读全文
相关推荐












ORA-06550: line 159, column 0: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare end exit for goto if loop mod null pragma raise return select update while with <an identifier> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge

ORA-06550: line 1, column 70: PLS-00103: Encountered the symbol ")" when expecting one of the following: ( - + case mod new not null <an identifier> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe <an alternatively-quoted string literal with character set specification> <an alternatively

Cause: java.sql.SQLException: ORA-06550: 第 26 行, 第 10 列: \nPLS-00103: Encountered the symbol \",\" when expecting one of the following:\n\n ( begin case declare end exception exit for goto if loop mod\n null pragma raise return select update while with\n <an identifier> \n << continue close current delete fetch lock\n insert open rollback savepoint set sql execute commit forall\n merge pipe purge\nThe symbol \",\" was ignored.\nORA-0655





