Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Help: Converting Teradata Case to Oracle Decode

Help: Converting Teradata Case to Oracle Decode

From: Jay Quinn <jpquinn_at_home.com>
Date: Fri, 16 Nov 2001 19:23:55 GMT
Message-ID: <3bf566d6.16858576@news>


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_Usage
FROM US0108 u
where u.cycle_code = '1'
and u.cycle_run_month = '08'
and u.cycle_run_year = '2001'
GROUP BY u.price_plan_code
ORDER BY u.price_plan_code
/

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:23:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US