Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I'm trying to figure out if I can get data back from the server for rows that are inserted with OracleBulkCopy Class[^]

I can successfully load data from client to the server but the problem is that I cannot define a mapping that would return data back to the client from the server.

The situation is that the primary key get's it's value from a sequence on the server side so for further operations at client side, I would need the generated value back for each inserted row.

What I have tried:

Reading documentation and googling.
Posted
Comments
Afzaal Ahmad Zeeshan 11-Dec-16 6:17am    
If you know how many were inserted, can you do the SELECT TOP n ... ORDER BY pk DESC? Does that work?
Wendelius 11-Dec-16 6:29am    
Thanks for the suggestion but I'm afraid that wouldn't work. There's no way to control parallel operations so the TOP query could return rows that are inserted by another, simultaneous connection.
Afzaal Ahmad Zeeshan 11-Dec-16 7:31am    
Continuing from comments, right, I tried figuring it out, but figured that the WriteToServer functions return void. Poorly written API.

https://docs.oracle.com/cd/E17666_01/doc/win.112/e17357/OracleBulkCopyClass.htm#CHDHHABB
%ROWCOUNT also doesn't work. Major factor is this parallelism in this. I would suggest remove one factor — consider semaphores, locks etc. Otherwise this is a bit difficult problem.
Wendelius 11-Dec-16 7:49am    
Parallelism is always present with databases, you never know who's connected and doing what, so we just have to live with that :)

I can work around this problem by using other approaches, but I'm just interested if this requirement can be satisfied with bulk copy.
Afzaal Ahmad Zeeshan 11-Dec-16 7:51am    
Indeed, which can be minimized with semaphores. ;-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900