Reputation: 792
A user is uploading a file to apex using the data load wizard. What I want to do is after the data load wizard has finished inserting/ updating the data in the database table, I want to run a piece of code, specifically a merge on the records then an additional update.
I'm thinking I need to input an additional process on third or fourth Page of the data load wizard, but not sure where the best place would be for it. Thanks
Below is the code I wish to add:
truncate table TEMP_UPLOAD;
Merge into INVOICE b
USING (
SELECT CUSTOMER_CLASS,RULE_AGGREGATOR,BA
FROM CUSTOMER_TEMP_UPLOAD
WHERE CUSTOMER_CLASS = 'CUSTOMER88') u
ON (b.BA = u.BA)
WHEN MATCHED THEN UPDATE SET b.CUSTOMER88_DATE_UPDATED = sysdate
WHEN NOT MATCHED THEN
INSERT (b.CUSTOMER_CLASS,b.RULE_AGGREGATOR,b.BA,b.CUSTOMER88_DATE_ADDED)
VALUES (u.CUSTOMER_CLASS,u.RULE_AGGREGATOR,u.BA,sysdate);
UPDATE INVOICE a
SET a.CUSTOMER88_DATE_REMOVED = sysdate
WHERE BA IN
(select b.BA
from INVOICE b
left join CUSTOMER_temp_upload u
on b.BA = u.BA
where u.BA is null and b.CUSTOMER_CLASS = 'CUSTOMER88');
Below are screenshots of the dataload wizard. Note the wizard starts with Pg2. Pg1 is the home screen.
Upvotes: 1
Views: 1332
Reputation: 60262
Your page 4 has a process Prepare Uploaded Data
which actually does the data loading.
You can add an additional process after that point that will run after the data was loaded.
Upvotes: 3