Page 1 of 1

Manually set Identity field in Oracle

Posted: Thu 25 Jul 2019 21:06
by iamnotcreative
Hello everyone, I apologize in advance if this has already been asked.

We're a VB.Net shop with two Oracle databases, let's call one local and the other web. Local has a table with an ID column that is populated via a trigger, this works just fine in our code; the insert statement is generated correctly and the ID is brought back into the object. What I need to do is then take that ID value and use it in the INSERT statement that's being generated for inserting into the web database version of that same table. So basically:

Insert into local.table (foo, bar) values (:p1, :p2) returning ID into :ret1

Insert into web.table (id, foo, bar) values (:ret1, :p1, :p2)

Any help would be appreciated.

Re: Manually set Identity field in Oracle

Posted: Thu 25 Jul 2019 21:45
by iamnotcreative
To clarify, I am setting the ID column in the web.table object and then using the .InsertOnSubmit and .SubmitChanges methods in the Devart.Data.Linq.DataContext class

Re: Manually set Identity field in Oracle

Posted: Mon 29 Jul 2019 14:17
by Shalex
1. Could you please describe the issue you have encountered with assigning WebTable.ID=LocalTable.ID after submitting LocalTable and before submitting WebTable?

2. How are you submitting data to LocalTable and WebTable?
a) the same DataContext class, two DataContext instances (a separate instance with its mapping for each table)
b) two DataContext classes (a separate class for each table)