Answers for "case when in sql ORACLE"

SQL
1

oracle switch case

SELECT user_id,  user_type_id,
  CASE user_type_id
    WHEN 1 THEN 'Jump'
    WHEN 2 THEN 'Run'
    WHEN 3 THEN 'Walk'
    WHEN 4 THEN 'Sprint'
    ELSE 'Stand Still'
  END
FROM users;

or you can use decode :
SELECT
DECODE(1, 1, 'One')
FROM
dual;
Posted by: Guest on October-23-2021
1

oracle case

SELECT product_id, product_type_id,
  CASE product_type_id
    WHEN 1 THEN 'Book'
    WHEN 2 THEN 'Video'
    WHEN 3 THEN 'DVD'
    WHEN 4 THEN 'CD'
    ELSE 'Magazine'
  END
FROM products;
Posted by: Guest on June-12-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language