I've copied a query from Teradata to use in Oracle. Works fine in Teradata, but give error in Oracle 12c
ORA-00904: "my_years": invalid identifier
Is there a work-around?
Case
when years = 1 then 'red'
when years =2 then 'blue'
when years = 3 then 'green'
end as my_years,
case
when my_years between 1 and 5 then '01-05 years'
when my_years between 6 and 10 then '06-10 years'
when my_years between 11 and 15 then '11-15 years'
end as year_bands
Want to see
my_years Year_band
red 01-05 years
blue 06-10 years
green 11-15 years