The CASE WHEN statement in Oracle is used to return different values based on conditions. Syntax: CASE WHEN condition THEN result ELSE default_result END. Usage: 1. Condition check: WHEN clause contains the condition and returned result; 2. Default result: ELSE clause specifies the default result when any condition is not met. Example: Return income_level based on salary value: salary > 5000: high income; 3000 ≤ salary ≤ 5000: middle income; salary < 3000: low income.
CASE WHEN usage in Oracle
The CASE WHEN statement is a conditional expression that is used to Group conditions return different values. It is very useful when dealing with complex data queries and operations.
Syntax:
6cd0c67c4c252a849ce4a89f382b85eeResult:
This query will return the income_level column based on the employee’s salary value:
Note:
The above is the detailed content of casewhen usage in oracle. For more information, please follow other related articles on the PHP Chinese website!