Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Help: Teradata Case Converted to Oracle Decode
Hi, here is my Teradata SQL that uses a CASE statement which runs
fine.
select price_plan_code,
SUM(CASE WHEN CYCLE_RUN_MONTH = '08' AND CYCLE_RUN_YEAR = '2001' THEN
REPORTED_TIME_DUR ELSE 0 END) AUG_USAGE,
SUM(CASE WHEN CYCLE_RUN_MONTH = '09' AND CYCLE_RUN_YEAR = '2001' THEN
REPORTED_TIME_DUR ELSE 0 END) SEP_USAGE
FROM LD_ACCESS_VIEWS.VSLU001_USAGE_DETAIL
GROUP BY 1
ORDER BY 1
Here is my Oracle SQL with a Decode statement thus far. It gives me
the error, line 2: not a GROUP BY expression., I know it is though.
select u.price_plan_code, decode (u.cycle_run_month, '08', u.reported_time_dur), decode (u.cycle_run_year, '2001', u.reported_time_dur) Aug_Usage, decode (u.cycle_run_month, '09', u.reported_time_dur), decode (u.cycle_run_year, '2001, u.reported_time_dur) Sep_UsageFROM US0108 u
I need the Oracle Decode Syntax, if anyone could please share it with me and take a look at this code and recommend some changes.
Thanks, Jay Received on Fri Nov 16 2001 - 13:24:54 CST
![]() |
![]() |