I need to keep two tables in a syc so when row inserted in Table A and one of column has certain condition then record should be added in table B. Also when row inserted in Table B then record should be added in Table A. How can this accomplish using Triggers. I had triggers for both tables After Insert but gives ORA-04091 error.
ORA-04091 Error Keep two tables in sync using triggers
151 Views Asked by mbk At
2
There are 2 best solutions below
Related Questions in ORACLE
- Column displays each count
- MAX and GROUP BY - SQL
- Best Practice for adding columns to a Table in Oracle database
- Updating an Oracle row with value from same row
- Retrieving data from Oracle database
- Ibatis execute update sql on oracle, it is not working and no exceptions
- Building an sql execution plan history
- Implementation of Rank and Dense Rank in MySQL
- how to update the date field for this specific condition using oracle query?
- Oracle stored procedure wrapping compile error with inline comments
- Android: How to connect oracle database using Android Java code?
- SQL Conditional Join on Columns
- Multi value wildcard search in ibatis
- Get count of consecutive days meeting a given criteria
- How to update the metadata of a layer in Oracle imported through FME Workbench?
Related Questions in TRIGGERS
- PL SQL After Delete Trigger Not Inserting Record
- change content button with trigger
- Insert into Change Log based on Trigger After Update
- Animation Trigger (Storyboard + Trigger) in C#
- delete trigger to delete row in another table in another database sql
- Add extra column in insert with instead of trigger
- Check if inserted row is the same as current
- SQL Trigger Error Code
- Trigger vs. Dependency Property precendence
- Mysql #1235 error code, when create 2 triggers with different purposes
- if x not in(select y from table) in oracle
- Edit DataGrid Cell on mouse over
- SQL Trigger Update Average
- SQL Trigger doesn't get fired
- Get deleted values from 3 tables and put in 1 table
Related Questions in ORA-04091
- ORA-04091 on Create or Replace Trigger xxx Before Insert of Update on xxx
- ORA-04091 table is Mutating
- "ORA-04091 - Table "b" is mutating, trigger/function may not see it" when updating table "a" based on inserts, updates, and deletes from table "b"
- ORA-04091 tableT is mutating, trigger/function may not see it
- ORACLE TRIGGER WITH JOIN
- Oracle Trigger error - ORA-04091: table is mutating, trigger/function may not see it
- problem with trigger in oracle
- Simple oracle triggers
- Oracle After Delete Trigger... How to avoid Mutating Table (ORA-04091)?
- Oracle calculate average using a trigger
- Translation of DB2 Trigger to Oracle triggers ORA-04091 Error
- BEFORE TRIGGER causes ORA-04091
- Delete rows matching substring with LIKE?
- Automatically Update Field in Database
- How to use data from the updated table in a trigger?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Table is mutating, which means that you are selecting from it at the same time it is being affected by insert (or update). Since 11g, a compound trigger is the way out of it. In earlier Oracle versions (10g and lower) package has been used to deal with it.
However, mutating table frequently raises a question: are you doing it correctly? Maybe code you use can be rewritten so that error is avoided.
Finally, if those two tables contain the same data, why do you have two tables instead of one?