MERGE INTO deneme1 d
USING (SELECT a.ref_no, a.g_no, b.customer_id
FROM deneme1 a, deneme2 b
WHERE a.req_id = b.req_id) src
ON (d.g_no = src.g_no AND d.ref_no = src.ref_no)

WHEN NOT MATCHED THEN

INSERT (customer_id, g_no, ref_no, cr_user, cr_date)
VALUES (src.customer_id, src.g_no, src.ref_no, ‘orhan’,
SYSDATE)

WHEN MATCHED THEN

UPDATE SET d.customer_id = src.customer_id, d.upd_user = ‘orhan’,
d.upd_date = SYSDATE;

Reklamlar