Locks; default incorrect w/ PL/SQL?

From: Hans Bergsten <hans_at_ebu.ericsson.se>
Date: Wed, 16 Feb 1994 05:13:04 GMT
Message-ID: <1994Feb16.051304.16829_at_exu.ericsson.se>


Hi guys,

I have run into some strange behavior regarding default locks acquired during PL/SQL processing. My platform is ORACLE 7.0.15 on a SunOS 4.1.x/Sparc.

If I make an insert to, or updates, a table in SQL*Plus, I get a Row Exclusive Table Lock (RX) on the table, exactly as it is described in the manual.

But if I make a call to a Stored Procedure from an anonymous PL/SQL block, that makes a call to another Stored Procedure (in a different package) that updates the table, I get a Share Row Exclusive Table Lock (SRX) on the table! This means no one else can update any rows in the table until I release my lock. According to the manual this type of lock can only be set by an explicit SQL statement (LOCK TABLE table IN SHARE ROW EXCLUSIVE MODE). I also get Share Table Locks on tables that I only read in my Stored Procedures, and that is also something that must be requested explicitly according to the manual.

What's going on here? I have not yet been able to isolate the problem down to a size where I can post the exact code. But I am doing nothing but straight SELECT's, UPDATE's and INSERT's in my Stored Procedures. I do one thing that may not be so common; I cash some values in variables declared in a PACKAGE, and use the values later in the same session.

Has anyone experienced similar problems, and have a work-around or explanation. All answers will really be appreciated.

/Hans

---
Hans Bergsten                 	   Internet : ebuhob_at_ebu.ericsson.se
Ericsson Business Communications   MEMO     : VAX.EBUHOB..EBU.ERICSSON.SE..INET
5757 Plaza Drive                   Voice    : +1 (714) 236-6784
Cypress, CA 90630-0007, USA        FAX      : +1 (714) 236-6039
Received on Wed Feb 16 1994 - 06:13:04 CET

Original text of this message