Submitting a batch/block of insert statements using C#?

From: <dana_at_work_at_yahoo.com>
Date: Wed, 28 Jan 2009 07:19:17 -0800 (PST)
Message-ID: <8d1efe8e-e424-4a1b-9e7a-ae9ac45090aa_at_p23g2000prp.googlegroups.com>



A programmer colleague of mine asked if he could submit a batch of insert statements to Oracle (9i) using C#. And if there's any way to identify which insert statement, if any failed during the batch execution.

The idea is to improve performance by preventing client/server back and forths, e.g. better to submit 1,000 insert statements as a batch/ block, have the server execute the statements in one go, then send back a single response than to have 1,000 round-trips for each insert (rolling back if there's an error).

Can this be done in C# without any PL/SQL? If so, how? The programmer is using this mechanism to communicate with Oracle:

http://msdn.microsoft.com/en-us/library/system.data.oracleclient.aspx

Although you can get a transaction defined using the above, then loop through your inserts, I don't think it's submitting everything to the server as a block. One final note: we can't use any solution requiring stored procedures on the server side; the admins won't permit it and this is a rule we can't change.

Thanks.

Dana Received on Wed Jan 28 2009 - 09:19:17 CST

Original text of this message