Skip to Main Content

Oracle Database Discussions

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Why deadlock

Anand YadavMay 7 2016 — edited May 7 2016

CREATE OR REPLACE PROCEDURE PROC1

AS

BEGIN

    INSERT INTO TAB1 ( cust_id, cust_name)

         VALUES (12, 'Some name');

    PROC2;

END;

/

SHOW ERRORS;

CREATE OR REPLACE PROCEDURE PROC2

AS

    PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

    INSERT INTO TAB2 ( item_id, cust_id, item_name)

         VALUES (12, 12, 'Any name');

    COMMIT;

END;

/

SHOW ERRORS;

EXECUTE PROC1;

Error:

ORA-00060: deadlock detected while waiting for resource

ORA-06512: at "schema.PROC2", line 5

ORA-06512: at "schema.PROC1", line 6

ORA-06512: at line 1

I have referential integrity defined on  TAB2 (cust_id) to TAB1(cust_id) .  as per my understanding, Autonomous transaction creates separate transaction and in that situation it should raise parent key not found exception. Please help me to understand.

Also if I insert parent record in one session and without committing it if I insert child record in another session then session related to child record is hanging in place of giving error.

Note:This code is just for illustration purpose

This post has been answered by Jonathan Lewis on May 7 2016
Jump to Answer

Comments

593443
The mainpage promises "The initial plugin supports the ability to connect to Oracle Databases (Oracle 9iR2 and Oracle 10g),"

which is partially true.

You can connect to a 9i database thru the 10g driver but you won't see any addtitional information about the database which is quite weak.

Guys from Oracle, please add an addtional 9i connector!
594678
possibly that's the source of the prob i have with not displayed stuff like database links in 9i
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 4 2016
Added on May 7 2016
5 comments
5,033 views