2011-03-30 44 views
1

即時嘗試合併到表中。合併成匹配woron

這個選擇犯規找到什麼:

select * from dpr where dpr_qot_id=1111; 

然後我運行該合併像follwing:

MERGE INTO dpr d 
USING (select dpr_ts, dpr_qot_id 
     from dpr 
     where dpr_qot_id = 1111 
      and dpr_ts = to_date('30.11.1999', 'DD.MM.YYYY')) s 
on (s.dpr_ts = d.dpr_ts and s.dpr_qot_id = d.dpr_qot_id) 
when not matched then 
    insert 
    (DPR_TS, 
    DPR_CLOSE, 
    DPR_OPEN, 
    DPR_HIGH, 
    DPR_LOW, 
    DPR_VOLUME, 
    DPR_QOT_ID) 
    values 
    (to_date('30.11.2010', 'DD.MM.YYYY'), 
    21.66, 
    21.75, 
    22.005, 
    21.66, 
    2556.00, 
    1111) 
WHEN MATCHED THEN 
    UPDATE 
    set DPR_CLOSE = 21.66, 
     DPR_OPEN = 21.75, 
     DPR_HIGH = 22.005, 
     DPR_LOW = 21.66, 
     DPR_VOLUME = 2556.00; 

,仍然選擇這種沒有找到任何東西:

select * from dpr where dpr_qot_id=1111; 

我究竟做錯了什麼?

謝謝!

問候 瑪格達

+0

你確定你的合併被提交嗎? – 2011-03-30 15:36:24

+0

如果您有其他問題,請隨時打開另一個問題。 – 2011-04-01 06:38:52

回答

3

由於沒有DPR行,其中dpr_qot_id = 1111,你的對手的源(使用)的查詢也將不包含任何行,所以沒有被合併的數據 - 所以沒有什麼是完成。