Questions tagged [mutating-table]

Mutating table errors generally happen when a trigger tries to reference/modify the same table on which trigger is firing on.

Mutating table/trigger errors are mostly caused when you try to reference/modifies the table on which the trigger is firing.

The error generally refers to a flaw in application logic or data model.

APC explains the data model flaw:

Some highly viewed questions/solutions on this

64 questions
0
votes
2 answers

Call a stored procedure in a trigger PL/SQL

Well I'm trying to call a stored procedure in my trigger. The error I'm getting "table %s.%s is mutating, trigger/function may not see it" *Cause: A trigger (or a user defined plsql function that is referenced in this statement)…
riyay
  • 1
  • 1
0
votes
3 answers

Trigger selecting child records, multiplying their values and updating parent record

I am a PL/SQL newbie and I'm struggling with a trigger. Description: I have three objects - PRODUCT, CONTAINS, ORDER. One product can have many CONTAINS and one ORDER can have many CONTAINS (basically it used to be Many-to-many relationship between…
DevelBase2
  • 139
  • 6
0
votes
1 answer

ORA-04091 table * is mutating, trigger/function may not see it

I am working on a project that rents boats to customers and based on information they enter supplies them with a boat. One section of this project I want to create a trigger that based on when you leave with the boat vs when you return it will…
Boooo402
  • 27
  • 1
  • 9
0
votes
2 answers

SQL - Count number of rows in a table before updating it

Im doing a college project on Oracle SQL and I keep getting the error "table (...) is mutating, trigger/function may not see it" when I try to update a table. My participateTeams table has 3 columns (eventName varchar(), teamId number, teamPlace…
0
votes
1 answer

how to use triggers to inherit values from another "parent" record in same table

I feel like this is one of those "if you're careful you can do it" scenarios that Oracle just doesn't want to let me do. My problem is that I have a single configuration table that I want to enable inheritance via Triggers. Think an Employee table…
Michael Lowden
  • 103
  • 2
  • 10
0
votes
1 answer

Compound Triggers

Problem - Want to avoid the problem of mutating triggers by using the compound trigger. But unable to do so Background - I want to insert data in new table " Tracking Table " whenever there is change in Main table "CUSTOM_ITEM" Design is such…
0
votes
0 answers

Getting Mutating error while running trigger

I am getting table is mutating error when I try to update the table update flight set captainStaffID='S0009' where flightid='000000043'; Here is the trigger: create or replace trigger trigger1 before INSERT OR UPDATE of…
0
votes
1 answer

Mutating table trigger error for one type of insert statement

I'm getting mutating table error for statement insert into employee select 'xyz',200 from dual and scripts executes successfully for insert into employee values ('abc',100);. Can somebody explain why the statement fails for one type of insert…
philippe
  • 5
  • 2
0
votes
1 answer

Oracle and mutating table with simple exercise

I'm in trouble with the implementation of a trigger. Assuming that I have two types: CREATE TYPE customer_t AS OBJECT( code INTEGER, name VARCHAR(20), surname VARCHAR(20), age INTEGER); and the type CREATE TYPE ticket_t AS OBJECT ( price…
Paolopast
  • 197
  • 1
  • 11
0
votes
0 answers

Trigger + mutation error + Cascade Update

For an assignment I am trying to do a cascade update with a trigger of a primary key to its foreign keys using Oracle. I cannot use the cascade update in the foreign key. Below is my code that generates the corresponding error: CREATE or REPLACE…
zcyl24
  • 1
0
votes
1 answer

Oracle mutating tables

I have this procedure which calculates the total amount paid for a car and determines if the car status can be changed to 'SOLD' if the amount is equal to the price. I know the problem is the query in car_payment but I can't find other way to make…
bril10
  • 7
  • 2
0
votes
3 answers

How Can I code a "IF UPDATING" trigger in Oracle Database 10g?

I'm coding a Trigger to ensure only one type of money can be set as official. My intention is code a "BEFORE INSERT OR UPDATE" trigger. The INSERT section works fine but the problem is coding the UPDATING section because when I try to update the…
Young Al Capone
  • 369
  • 1
  • 6
  • 25
0
votes
1 answer

Oracle trigger muating error

CREATE OR REPLACE TRIGGER Testtriger after insert ON table2 referencing new as new old as old for each row declare flagtemp varchar2(1); begin select flag into flagtemp from table2 where docid = :new.docid; --if…
ashish
  • 239
  • 2
  • 6
  • 13
0
votes
1 answer

Call object member function in a DML trigger after update (ORACLE database)

I have a database with a table PRODUCTS of objects Product where the PRIMARY KEY is the EAN field. Every time a row is updated I want to call a member function of the new object Product modified. I made this trigger: CREATE OR REPLACE TRIGGER…
Maghio
  • 355
  • 1
  • 6
  • 18
0
votes
2 answers

Simple oracle triggers

Simple one. I´m a bit of a newvbie with PLSql and oracle's error messages are never too helpful. I want to do a simple trigger to update a column with the current date i.e. 'modified date' column of a table. Getting an odd error though. The idea is…
filippo
  • 5,583
  • 13
  • 50
  • 72