I have a big calculation which will give numeric values and needs to be compared for greater than and less than
CASE big_expression
WHEN > 0 AND <5 THEN 'Less Than 5 Days'
WHEN > 5 AND <20 THEN 'Between 5 and 20 Days'
-
Can this be done or I need to use the expressions every time I make a comparison
You can use CTE for the same
WITH data
AS (SELECT 1 + 2 + 5 + 9 AS big_exp
FROM dual)
SELECT CASE
WHEN big_exp > 0
AND big_exp < 5 THEN 'Less Than 5 Days'
WHEN big_exp > 5
AND big_exp < 20 THEN 'Between 5 and 20 Days'
ELSE 'Greater than 20 days'
END
FROM data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.