OldCPW
OldCPW

Reputation: 65

Oracle trigger sequence

I have a problem with the Oracle trigger. There are two tables A & B, and both of them have the incremental field seq_num_a & seq_num_b, and A has a trigger that if insert into A will write the same to B. Now if I insert A table but not commit, and the other one insert A and commit.

Table A
seq_num_A,| byWho
1,        | Me
2,        | Other

I think that B should be

Table B
seq_num_B,| byWho
1,        | Other
2,        | Me

because I commit after the other one, but B still show the value

Table B
seq_num_B,| byWho
1,        | Me
2,        | Other

how can we fix this problem?

Upvotes: 0

Views: 54

Answers (1)

Tony Andrews
Tony Andrews

Reputation: 132570

Incremental columns (i.e. columns based on sequences) are assigned their value on INSERT, not on COMMIT. So it is the INSERT order that determines the record ordering, not when those inserts were committed.

Upvotes: 2

Related Questions