I want to select "up_year" with SQL case expression.
if I do this its ok:
SELECT CASE WHEN column1 = '2020' then 'up_year' else 'past_year' else end ;
but when trying to do like this : do not want to change every year.
SELECT
CASE WHEN column1 = (select extract(year from sysdate) from dual)
then 'up_year'
else 'past_year' else end ;
You simply want to match for the current year. Then one option would be using TO_CHAR(,'yyyy')
:
SELECT CASE
WHEN column1 = TO_CHAR(sysdate,'yyyy') then
'up_year'
ELSE
'past_year'
END AS "My Year"
FROM tab