Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> MERGE statement not working with use of hints
The following code has been written under Oracle 10g R2.
The first merge statement
will insert rows into the stg_provider table. However, if any hint at all
is used
nothing will be written. I have other procedures using merge statements
with hints
which work just fine. Any suggestions on where I should look would be
appreciated.
MERGE INTO stg_provider a
USING TABLE( load_stg_provider() ) b ON ( a.prpr_id = b.prpr_id AND a.effective_date = b.effective_date AND a.terminated_date = b.terminated_date AND a.sys_contract_mbr = b.sys_contract_mbr AND a.mbr_contrived_key = b.mbr_contrived_key AND a.subscriber = b.subscriber AND a.suffix = b.suffix AND a.elig_class_prod_cat = b.elig_class_prod_cat )
WHEN NOT MATCHED THEN
INSERT
(
prpr_id, effective_date, terminated_date, sys_contract_mbr, mbr_contrived_key, subscriber, suffix, elig_class_prod_cat ) VALUES
(
b.prpr_id, b.effective_date, b.terminated_date, b.sys_contract_mbr, b.mbr_contrived_key, b.subscriber, b.suffix, b.elig_class_prod_cat );
COMMIT;
==
Merge statement with hint which doesn't write anything.
==
MERGE /*+ APPEND */ INTO stg_provider a
USING TABLE( load_stg_provider() ) b ON ( a.prpr_id = b.prpr_id AND a.effective_date = b.effective_date AND a.terminated_date = b.terminated_date AND a.sys_contract_mbr = b.sys_contract_mbr AND a.mbr_contrived_key = b.mbr_contrived_key AND a.subscriber = b.subscriber AND a.suffix = b.suffix AND a.elig_class_prod_cat = b.elig_class_prod_cat )
WHEN NOT MATCHED THEN
INSERT
(
prpr_id, effective_date, terminated_date, sys_contract_mbr, mbr_contrived_key, subscriber, suffix, elig_class_prod_cat ) VALUES
(
b.prpr_id, b.effective_date, b.terminated_date, b.sys_contract_mbr, b.mbr_contrived_key, b.subscriber, b.suffix, b.elig_class_prod_cat );
COMMIT; Received on Thu Dec 07 2006 - 19:27:49 CST