---
title: "Case When Else in Oracle SQL"  
description: "Case When Else in Oracle SQL"  
author: "Utpal Vishwas"  
published: 2023-07-17  
updated: 2023-07-18  
canonical: https://www.mindstick.com/forum/159124/case-when-else-in-oracle-sql  
category: "oracle"  
tags: ["database", "sql", "oracle"]  
reading_time: 2 minutes  

---

# Case When Else in Oracle SQL

Case When Else in [Oracle SQL](https://www.mindstick.com/forum/159138/oracle-sql-casting-string-as-date-how-works)

## Replies

### Reply by Aryan Kumar

The **CASE WHEN ELSE** statement in [Oracle](https://www.mindstick.com/articles/13016/alter-table-statement-or-command-in-oracle) [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) is a conditional statement that allows you to evaluate a condition and return a different result depending on the outcome of the evaluation. The CASE WHEN ELSE statement is a powerful tool that you can use to perform complex conditional logic in your SQL queries.

The syntax for the CASE WHEN ELSE statement is as follows:

SQL

```plaintext
CASE WHEN condition1 THEN result1
WHEN condition2 THEN result2
...
ELSE default_result
END;
```

The `condition1`, `condition2`, etc., are expressions that can be evaluated to a Boolean value. The `result1`, `result2`, etc., are the results that will be returned if the corresponding condition evaluates to `TRUE`. The `default_result` is the result that will be returned if none of the conditions evaluate to `TRUE`.

For example, the following CASE WHEN ELSE statement will return the grade of a student based on their score:

SQL

```plaintext
CASE WHEN score >= 90 THEN 'A'
WHEN score >= 80 THEN 'B'
WHEN score >= 70 THEN 'C'
WHEN score >= 60 THEN 'D'
ELSE 'F'
END;
```

If the student's score is greater than or equal to 90, then the CASE WHEN ELSE statement will return the letter grade `A`. If the student's score is greater than or equal to 80, but less than 90, then the CASE WHEN ELSE statement will return the letter grade `B`. And so on. If the student's score is less than 60, then the CASE WHEN ELSE statement will return the letter grade `F`.

The CASE WHEN ELSE statement is a powerful tool that you can use to perform complex conditional logic in your SQL queries. By using the CASE WHEN ELSE statement, you can write more concise and readable queries that are easier to understand and maintain.


---

Original Source: https://www.mindstick.com/forum/159124/case-when-else-in-oracle-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
