Mega Code Archive

 
Categories / Oracle PLSQL / Select Query
 

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>