cindy
cindy

Reputation: 35

How to Truncate Multiple Table in SSIS ( using ADO.NET Destination and Oracle Database)

I got a little trouble in SSIS. I have multiple table and i want adding Truncate statement so that table can't create double data.

This is the image of package that I made :

http://i63.photobucket.com/albums/h140/cindylolietra/17027495-bb91-4f8c-a660-c5eebab904ba_zps64ac0ad9.png

each Data Flow, i used Flat File Source and ADO NET Destination.

And then, in Execute SQL Task i want to apply Truncate Table

http://i63.photobucket.com/albums/h140/cindylolietra/truncate2_zps1b39513d.png

After that, i have error message :

"[Execute SQL Task] Error: Executing the query "truncate table Table1 truncate table Tabl..." failed with the following error: "ERROR [HY000] [Oracle][ODBC][Ora]ORA-00911: invalid character". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly."

What i must suppose to do?

P.S Sorry if my english is not good

Upvotes: 2

Views: 8140

Answers (2)

Marco Baldelli
Marco Baldelli

Reputation: 3728

Since the destination is an Oracle Database you should use this syntax:

begin
   execute immediate 'truncate table t1';
   execute immediate 'truncate table t2';
end;

Upvotes: 2

Nick.Mc
Nick.Mc

Reputation: 19184

Does this syntax work:

truncate table table1;

truncate table table2;

Note the semi colons.

Upvotes: 0

Related Questions