Re: Submitting a batch/block of insert statements using C#?
Date: 28 Jan 2009 10:36:41 -0700
: 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
: 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).
I would expect you could send an anonymous block. That would be sent as a single statement and send back a single response.
sqlString = "declare linenumber number:=1; begin insert into t values ('a','b'); linenumber :=1+linenumber; insert into t values ('A','B'); -- etc. exception raise_application_error(-20000,'line='||linenumber||sqlerrm); end ; " ( the final ";" may not be wanted)
That would be allowed in MS Access (as a pass-thru query), so I assume c# could allow that. Received on Wed Jan 28 2009 - 11:36:41 CST