开发者

OracleBulkCopy AutoCommits

C#.Net I am using OracleBulkCopy to copy data to global temp tables that are declared as Delete on commit. So when I use OracleBulkCopy.WriteToServer(Da开发者_StackOverflow社区taReader). It commits and I am losing all the data. How to prevent this?


OracleBulkCopy seems not to support transactions. Auto commit is never smart to use, copy in a more controlled way for example using bulk inserts.

OPEN z;
LOOP
    FETCH z BULK COLLECT INTO z_array LIMIT z_array_size;

    FORALL i IN 1..z_array.COUNT
    INSERT INTO t2 VALUES z_array(i);

    EXIT WHEN z%NOTFOUND;
END LOOP;


It is no good idea to declare global temporary tables as Delete on commit when using .NET anyway.

Better practice is to delete from gtt before doing whatever you want and let it as it is after commit. Debugging becomes easier too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜