2012-05-04 67 views
0

我無法使此查詢運行。我不斷收到ORA-00933錯誤。據我所知,它應該「結束」就好了......這裏沒有任何特別的想法。任何幫助將不勝感激。謝謝!ORA-00933:SQL命令未正確結束神祕錯誤

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 
+0

請請請格式化你的代碼按準則幫助我們更輕鬆地查看您的代碼。謝謝 – Satya

+0

對不起!仍然得到這個的竅門。 –

回答

0

在( '1', '2')sub.region_id

你缺少並在此之後所以這應該是

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

謝謝Satya!我想我已經盯着這個太久了。 –

+0

:)沒有問題發生 – Satya

相關問題