I am loading data into one temp table from that table to new table. But I did not apply the check that data is available in the source or not ? So what should be the behavior of Replace option in that case? also explain the behavior.
Asked
Active
Viewed 329 times
0
-
What database are you using? I'm guessing by SQL*Loader it is oracle. – John D Jun 19 '12 at 04:59
-
@john: Yes I am using Orcale 10g – Learner Jun 19 '12 at 05:21
1 Answers
0
Your best bet is to look at the Oracle MERGE option. You can specify on what conditions to INSERT/DELETE/UPDATE:
MERGE INTO target_table tt
USING stage_table st
ON (st.key = tt.key)
WHEN MATCHED THEN
UPDATE SET tt.colA = st.colA
DELETE WHERE (st.delInd = 'Y')
WHEN NOT MATCHED THEN INSERT (tt.key, tt.colA)
VALUES (st.key, st.colA);

John D
- 2,307
- 17
- 28