A searched CASE statement : Case Query « Select Query « Oracle PL / SQL






A searched CASE statement

   


SQL> BEGIN
  2    CASE TRUE
  3    WHEN (1 > 3) THEN
  4      dbms_output.put_line('One is greater than three.');
  5    WHEN (3 < 5) THEN
  6      dbms_output.put_line('Three is less than five.');
  7    WHEN (1 = 2) THEN
  8      dbms_output.put_line('One equals two.');
  9    ELSE
 10      dbms_output.put_line('Nothing worked.');
 11    END CASE;
 12  END;
 13  /
Three is less than five.

PL/SQL procedure successfully completed.

SQL>

   
    
    
  








Related examples in the same category

1.You could use the case statement in an SQL statement
2.Combine case with NVL function
3.Combine Case with group by
4.Use the CASE expression and SUM function
5.Use the CASE expression and SUM function to create an order price report
6.case switch based on clob data
7.Use case ... when to output comments for marks
8.Use case when and grouping function together
9.Use case when clause to decode value
10.Use case when statement to replace if statement
11.Use case when statement with between ... and
12.Use case when statement with exists and subquery
13.Use case when statement with in()
14.Use case when statement with to_char() like
15.Use case when with comparasion operator
16.use case when to control the order index
17.case when count(*) NOT between ... and
18.Rename case when column