ORA-00933:SQL命令没有正确结束神秘错误

时间:2012-05-04 00:44:52

标签: sql

我无法运行此查询。我一直收到ORA-00933错误。据我所知,它应该“结束”就好了...这里没有什么特别的花哨。任何帮助将不胜感激。谢谢!

SELECT /*+ use_hash(r, sub) */
to_char(r.request_day,'YYYY-MM-DD') AS request_day,
r.marketplace_id,
CASE
    WHEN (r.client_name = 'CreturnRefundEngine' AND REGEXP_LIKE(r.client_unique_request_id,'^RMA[-][0-9]*[-][0-9]*$')) THEN 'RefundAtFirstScan'
    ELSE 'OTHER'
END early_refund_type, 
sum(r.reversal_id) as refund_qty
FROM
d_reversal_item_units r
JOIN
D_MP_ASINS sub 
ON
sub.asin = r.asin and
sub.region_id = r.region_id and
sub.marketplace_id = r.marketplace_id
WHERE
sub.subcategory_code in ('42400105','42400305','34900105') and
sub.marketplace_id in ('1','4') and
sub.region_id in ('1', '2')
r.region_id in ('1', '2') and
r.marketplace_id in ('1','4') and
r.request_day between to_date('20120101','YYYYMMDD')-110 and to_date('{RUN_DATE_YYYYMMDD}','YYYYMMDD')+1 AND
(
    (r.client_name = 'ConcessionsService' AND (r.client_unique_request_id LIKE '%RFNDcreturns%' OR r.client_reference_id LIKE 'CReturns-RR-%'))
    OR
    (r.client_name = 'CreturnRefundEngine' AND r.CLIENT_REFERENCE_ID_TYPE = 'RefundRequestReferenceID' AND REGEXP_LIKE(r.client_unique_request_id,'^[0-9]+-.*-[0-9]+$'))
    OR
    (r.client_name = 'creturnrefundengine' and regexp_like(r.client_unique_request_id,'^rma[-][0-9]*[-][0-9]*$'))
)
group by
to_char(r.request_day,'YYYY-MM-DD'),
r.marketplace_id,
case
    when (r.client_name = 'CreturnRefundEngine' and REGEXP_LIKE(r.client_unique_request_id,'^RMA[-][0-9]*[-][0-9]*$')) then 'RefundAtFirstScan'
    else 'OTHER'
end

1 个答案:

答案 0 :(得分:0)

('1','2')中的sub.region_id

你错过了,所以这应该是

sub.region_id in ('1', '2') AND