Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002

    Red face Unanswered: isolation in table with autogenerated primary key

    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.

  2. #2
    Join Date
    May 2003
    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.

  3. #3
    Join Date
    Dec 2002

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts