我已将一个Mysql查询转换为Oracle,并在执行时面临以下问题。
查询:
select oc.channel_id,
oc.oc_calendar_date,
to_number(to_char(oc.oc_calendar_date, 'ww')),
To_char(oc.oc_calendar_date, 'day') as DAY_WEEK,
to_number(to_char(oc.oc_calendar_date, 'ww'), 1) -
to_number(to_char(trunc(sysdate, 'ww')), 1),
(CASE
when to_number(to_char(oc.oc_calendar_date, 'ww'), 1) =
to_number(to_char(trunc(sysdate, 'ww')), 1) then
'Current Week'
else
('Prev Wk ' || (to_number(to_char(oc.oc_calendar_date, 'ww')) -
to_number(to_char(trunc(sysdate, 'ww')))))
end) as datediff,
oc.Package_ID,
orddet.order_completion_date as total_count
from (select tor.channel_id,
to_date(tor.order_completion_date) as order_completion_date,
tol.package_id as Package_ID
from tibom.tom_order tor,
tibom.tom_order_lines tol,
tibtcare_ppm.tcare_ppm_package tpp
where tor.order_id = tol.order_id
and tor.order_type = 'NEW'
and tor.order_status = 'COMPLETED'
and EXTRACT(MONTH FROM tor.order_completion_date) >=
EXTRACT(MONTH FROM current_date - 6)
and tpp.package_id = tol.package_id) orddet
right outer join (select oc.oc_calendar_date, channel_id, package_id
from hob_reports.ods_calendar oc,
tibtcare.tcare_channel_ref tcr,
tibtcare_ppm.tcare_ppm_package tpp
where EXTRACT(DAY FROM oc.oc_calender_date) <=
EXTRACT(DAY FROM current_date)
and EXTRACT(MONTH FROM oc.oc_calendar_date) >=
EXTRACT(MONTH FROM current_date - 6)) oc on (to_date(orddet.order_completion_date) =
to_date(oc_calendar_date) and
oc.channel_id =
orddet.channel_id and
oc.package_id =
orddet.package_id)
错误:
ORA-00904: "OC"."OC_CALENDER_DATE": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 30 Column: 46