Page 1 of 1

Truncate the table before inserting into it.

Posted: Wed Jun 13, 2007 11:38 am
by Minhajuddin
Hi all,
I have a scenario where I need to INSERT 17 Million records in a table

I need to truncate the table before inserting these records. i.e. before I insert these 17 Mi records I need to delete all the records from the target table.

I am using an Oracle enterprise stage. Is there a way in which I can truncate the whole table before I insert these records?

Thanks for the help.

Posted: Wed Jun 13, 2007 11:48 am
by shrey3a
In sql before tab use the Truncate statement or crate the sp and call it in sql before tab.


Clear and insert option will take al ot of time i.e. 17m rows.

Thanks

Posted: Wed Jun 13, 2007 12:11 pm
by Minhajuddin
I am using the Upsert option and in that we don't have any option for truncate.

Is creating a Stored Proc the only option?

Posted: Wed Jun 13, 2007 12:14 pm
by DSguru2B
You can also pass the truncate command in the OPEN/CLOSE command of the enterprise stage.

Posted: Wed Jun 13, 2007 12:57 pm
by Minhajuddin
Hi DSguru,

Can I pass an SQL like

truncate MyTable

in the open command of the enterprise stage. And does truncating of a table before inserting has any impact on the performance?

Posted: Wed Jun 13, 2007 1:07 pm
by DSguru2B
Yes. You can pass TRUNCATE command in the OPEN/CLOSE command. It will be the most performant operation.

Posted: Wed Jun 13, 2007 1:12 pm
by Minhajuddin
Thanks for the Help :D