If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > isolation in table with autogenerated primary key

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 16:23
zarconja zarconja is offline
Registered User
 
Join Date: Dec 2002
Posts: 25
Red face isolation in table with autogenerated primary key

hello...
I have two tables (T1 and T2) that it has like primary key to a field of type integer and identity. T2 has like foreing key the primary key of T1.

Appears the following process:

A first, inserted in T1 registry.

Second, I recover ID generated in T1 (SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1).

Third, inserted one in T2 with ID generated of T1.

I want to know that isolation level must have my data base for this process.
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 16:33
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Any isolation level will do (except UR) so long as all the statements are in the same UOW (Unit of Work) as defined by the commit statement (when all statements are completed).

The isolation level has more to do with applications that read data (and prevent others from updating until they are finishing reading the data) than it has to do with programs that update data.
Reply With Quote
  #3 (permalink)  
Old 11-05-03, 18:42
chuzhoi chuzhoi is offline
Registered User
 
Join Date: Dec 2002
Posts: 134
Re: isolation in table with autogenerated primary key

You should not care about isolation level in this particular example.

The value of IDENTITY_VAL_LOCAL() is cached in the connection session context and stays there for at least until the end of unit of work(commit/rollback). No other transactions can change the value.

-dmitri
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On