Manually set Identity field in Oracle

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
iamnotcreative
Posts: 6
Joined: Mon 19 Nov 2012 22:15

Manually set Identity field in Oracle

Post by iamnotcreative » Thu 25 Jul 2019 21:06

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.

iamnotcreative
Posts: 6
Joined: Mon 19 Nov 2012 22:15

Re: Manually set Identity field in Oracle

Post by iamnotcreative » Thu 25 Jul 2019 21:45

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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Manually set Identity field in Oracle

Post by Shalex » Mon 29 Jul 2019 14:17

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)

Post Reply