Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

enq: TX - row lock contention for foreign key

user60022Dec 21 2011 — edited Jan 4 2012
HI All,

My DB is 11.2 exadata machine.

I happend to get a case and don't know how to explain it.

session 1:

create table parent (
id number primary key);
create table child (
id number references parent,
name varchar2(20));
insert into parent values (3);

session 2:
insert into child values (3,'aa');

Session 2 hangs.

I am curious how oracle knows that 3 in parent table could be inserted? Othewise, why don't oracle just throw ORA-02291:parent key not found immediately as I issue 'insert into child values (3,'aa');'

Best regards,
Leon
This post has been answered by Toon Koppelaars on Dec 22 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2012
Added on Dec 21 2011
18 comments
4,703 views