Database 合并到匹配的woron中
我正试图合并到一个表中 此选择未找到任何内容:Database 合并到匹配的woron中,database,oracle,Database,Oracle,我正试图合并到一个表中 此选择未找到任何内容: select * from dpr where dpr_qot_id=1111; select * from dpr where dpr_qot_id=1111; 然后,我运行此合并,如下所示: MERGE INTO dpr d USING (select dpr_ts, dpr_qot_id from dpr where dpr_qot_id = 1111 and dpr_ts = to_
select * from dpr where dpr_qot_id=1111;
select * from dpr where dpr_qot_id=1111;
然后,我运行此合并,如下所示:
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;
select * from dpr where dpr_qot_id=1111;
我做错了什么
谢谢大家!
问候
Magda由于dpr_qot_id=1111没有dpr行,因此匹配的源(使用)查询也将不包含任何行,因此没有要合并的数据,因此没有任何操作。您确定合并已提交吗?如果有其他问题,请随时打开另一个问题。