Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: in addition -- ORA-04091: table mutating problem?

Re: in addition -- ORA-04091: table mutating problem?

From: <Diana_Duncan_at_ttpartners.com>
Date: Fri, 04 May 2001 11:46:26 -0700
Message-ID: <F001.002F97E7.20010504072144@fatcity.com>

What's your version of Oracle? I usually have a stock answer on how to solve this type of problem, but I just tried out your problem on my little Personal Oracle here, and to my INCREDIBLE surprise, the trigger worked and I didn't get an error. Does anyone know if that's just because I'm using Personal Oracle, or did they actually manage to guarantee consistency when the tables are mutating in 8.1.6? This is the trigger text I used:

     create or replace trigger bir_tableB
     before insert on tableB
     for each row
     declare
          cursor get_max_date is
               select max(create_date)
               from tableB;
          maxDate   date;
     begin
          open get_max_date;
          fetch get_max_date into maxDate;
          close get_max_date;

          if (:new.create_date < nvl(maxDate, :new.create_date)) then
               raise_application_error(-20101, 'New date must be greater
than any existing record.');
          end if;
     end bir_tableB;

Diana Duncan
TITAN Technology Partners
One Copley Parkway, Ste 540
Morrisville, NC 27560
VM: 919.466.7337 x 316
F: 919.466.7427
E: Diana_Duncan_at_ttpartners.com

                                                                                       
                            
                    Leslie Lu                                                          
                            
                    <leslie_y_lu@        To:     Multiple recipients of list ORACLE-L 
<ORACLE-L_at_fatcity.com>       
                    yahoo.com>           cc:                                           
                            
                    Sent by:             Fax to:                                       
                            
                    root_at_fatcity.        Subject:     in addition -- ORA-04091: table 
mutating problem?            
                    com                                                                
                            
                                                                                       
                            
                                                                                       
                            
                    05/03/2001                                                         
                            
                    07:11 PM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    ORACLE-L                                                           
                            
                                                                                       
                            
                                                                                       
                            




In addition to my previous question:

supposed you cannot use Max(date), and MUST use the cursor. (may be my example is not a good one), anyway, I'd like to know how to get around this mutating problem. Thank you!

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: Diana_Duncan_at_ttpartners.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri May 04 2001 - 13:46:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US