Search results
So simple you can use case statement here. CASE WHEN ISSUE_DIVISION = ISSUE_DIVISION_2 THEN CASE WHEN ISSUE_DIVISION is null then "Null Value found" //give your option Else 1 End ELSE 0 END As Issue_Division_Result
7 gru 2023 · If you want to do if-else-then logic in select, where or anywhere else in a statement, you need a case expression. This is a series of when clauses that the database runs in order: For example, if you want to map exam correct percentages to grade letters according to these rules:
The IF statement either runs or skips a sequence of one or more statements, depending on the value of a BOOLEAN expression.
Oracle CASE expression allows you to add if-else logic to SQL statements without having to call a procedure. The CASE expression evaluates a list of conditions and returns one of the multiple possible results. You can use a CASE expression in any statement or clause that accepts a valid expression.
In a simple CASE expression, Oracle Database searches for the first WHEN... THEN pair for which expr is equal to comparison_expr and returns return_expr. If none of the WHEN... THEN pairs meet this condition, and an ELSE clause exists, then Oracle returns else_expr. Otherwise, Oracle returns null.
Use a SELECT statement or subquery to retrieve data from one or more tables, object tables, views, object views, materialized views, analytic views, or hierarchies.
The database checks if EXAM_ID is equal to any of the values in the WHEN clauses. If EXAM_ID is, the corresponding string is returned. If no matches, the CASE expression returns null.