Hi
I am working with the Oracle Enterprise stage and would like to truncate a table and then insert records into it.
I tried the load option in the stage but it gives an error. I would like to do this by including custom code in the oracle stage, first truncate then insert records.How do I do this?
Please inform.
Bob
Delete then insert records
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 437
- Joined: Fri Oct 21, 2005 10:00 pm
Re: Delete then insert records
Bob,babbu9 wrote:Hi
I tried the load option in the stage but it gives an error. I would like to do this by including custom code in the oracle stage, first truncate then insert records.How do I do this?
What errors does it throw? If it could run without custom code would you prefer that? Did you have disable contraints = True and have the indexes set to rebuild? Other issue could be permissions, to truncate the table you either have to log in as the schema owner or have alter privileges on the table and all of its indexes.
Keith
Keith Williams
keith@peacefieldinc.com
keith@peacefieldinc.com
Re: Delete then insert records
We created a PL/SQL for similar item, except that we wanted to delete records from the table by source (one out of four) by day. We created a routine to execute before running the load job, but you could also call the procedure in the SQL/BEFORE window within the job.babbu9 wrote:Hi
I am working with the Oracle Enterprise stage and would like to truncate a table and then insert records into it.
I tried the load option in the stage but it gives an error. I would like to do this by including custom code in the oracle stage, first truncate then insert records.How do I do this?
Please inform.
Bob
Hello Babbu,
Just create another instance of the same table for the delete action. Make sure that the inputs for insertion and deletion instances of the table comes from the same transformer. Also make sure that delete output from the transformer should be done first before the insert.
Thanks,
rajesh
Just create another instance of the same table for the delete action. Make sure that the inputs for insertion and deletion instances of the table comes from the same transformer. Also make sure that delete output from the transformer should be done first before the insert.
Thanks,
rajesh