You could use the case statement in an SQL statement : Case Query « Select Query « Oracle PL / SQL






You could use the case statement in an SQL statement

   

SQL>
SQL>
SQL> -- You could use the case statement in an SQL statement as follows:
SQL>
SQL>     select table_name,
  2      CASE owner
  3      WHEN 'SYS' THEN 'The owner is SYS'
  4      WHEN 'SYSTEM' THEN 'The owner is SYSTEM'
  5      ELSE 'The owner is another value' END
  6      from all_tables
  7      where rownum<200;

TABLE_NAME                     CASEOWNERWHEN'SYS'THEN'THE
------------------------------ --------------------------
CON$                           The owner is SYS
RULESET$                       The owner is SYS
INDPART_PARAM$                 The owner is SYS
OL$                            The owner is another value
OL$HINTS                       The owner is another value
OL$NODES                       The owner is another value
SQL$                           The owner is SYS
SQL$TEXT                       The owner is SYS
SQLPROF$                       The owner is SYS
SQLPROF$DESC                   The owner is SYS

SQL>
SQL>
           
         
    
    
  








Related examples in the same category

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