Hi All,
I am stuck with a situation here that I never came across. I will try to depict in below. I am running it in Oracle 10g.
TABLE_A is empty before the start of the process. TABLE_B has a few million rows. Rest have few thousands.
INSERT INTO TABLE_A
SELECT * FROM TABLE_B;
MERGE INTO TABLE_A
USING TABLE_C
ON TABLE_A.PID = TABLE_C.PID
WHEN MATCHED
UPDATE
WHEN NOT MATCHED
INSERT;
MERGE INTO TABLE_A
USING TABLE_D
ON TABLE_A.PID = TABLE_D.PID
WHEN MATCHED
UPDATE
WHEN NOT MATCHED
INSERT;
MERGE INTO TABLE_A
USING TABLE_E
ON TABLE_A.PID = TABLE_E.PID
WHEN MATCHED
UPDATE
WHEN NOT MATCHED
INSERT;
due to the huge volume of data the merge statement had to deal with everytime it runs, it is consuming lot of time (hrs) to run. Is there a way to rewrite above merge sql's into one sql statement using outer joins? I tried a few approaches, but none seem to be practical. Please shed some light on the issue if you find a more straighter way to do the same.
Thanks