Hello,
I'm facing oracle trigger problem. Anyone can help or advise how to resolve it?
Below are the explaination on my problem
I've created a trigger for my program. When there is a new data insert into table moto_pvs_pulse_daily_yield_tmp, my program will checking and copy the data by each row and insert into table mt_pulse_daily_yield_tmp which is in other instance.
After I success insert into table mt_pulse_daily_yield_tmp, I need to delete the data in the original table (moto_pvs_pulse_daily_yield_tmp), but I'm getting the error as below:
ORA-04091: table MOTOPVS_OWN.MOTO_PVS_PULSE_DAILY_YIELD_TMP is mutating, trigger/function may not see it
Here are my code: - CREATE OR REPLACE TRIGGER moto_pvs_pulse_daily_yield_trg after INSERT ON moto_pvs_pulse_daily_yield_tmp FOR EACH ROW
-
DECLARE
-
v_sql_error moto_pvs_db_error.ora_error%TYPE;
-
-
BEGIN
-
IF :NEW.board_yield >= 0 THEN
-
insert into mt_pulse_daily_yield_tmp --MotoTrak Table
-
(factory_id,line_id,board_item_number,manufactory_day,panel_yield,board_yield,insert_datetime)
-
values
-
(:NEW.factory_id,:NEW.line_id,:NEW.board_item_number,:NEW.manufactory_day,:NEW.panel_yield,:NEW.board_yield,:NEW.insert_datetime);
-
-
DELETE MOTO_PVS_PULSE_DAILY_YIELD_TMP;
-
-
ELSE
-
INSERT INTO MOTO_PVS_DB_ERROR(FROM_PROCEDURE,ERROR_DATE,MESSAGE)
-
VALUES
-
( 'MOTO_PVS_PULSE_DAILY_YIELD_TRG', SYSDATE , 'BOARD YIELD VALUE FOR FACTORY_ID: ('||:NEW.factory_id||') AND LINE_ID: ('||:NEW.line_id||') MUST BE POSITIVE');
-
-
END IF;
-
-
EXCEPTION
-
WHEN OTHERS THEN
-
v_sql_error := SQLERRM;
-
INSERT INTO moto_pvs_db_error (from_procedure, error_date, message, ora_error)
-
VALUES ('MOTO_PVS_PULSE_DAILY_YIELD_TRG', SYSDATE, 'ERROR DURING UPLOADING YIELD DATA', v_sql_error);
-
-
END moto_pvs_pulse_daily_yield_trg;
/
P/S: I believed this line is "DELETE MOTO_PVS_PULSE_DAILY_YIELD_TMP;" is caused the problem. but how to resolve it? Is really highly appreciate if anyone can advise me. Thank you very much.
4 2322
This Error is caused because the TRIGGER is trying to perform DML operation on the table on which it is based upon.
Check out for solution Here
Hi,
Thanks for your quick response. I had read through the solution url you provide, but still not really understand how to resolve the problem. Can I delete the data for it own table in the trigger itself?
Thanks
Follow the below steps:
1. Create a Package Spec that will have two Arrays (one will hold the ROWID of the newly inserted value and the second one is to reset the first one else u can also use empty constructor)
2. Create a BEFORE INSERT statement LEVEL TRIGGER ON MOTOPVS_OWN.MOTO_PVS_PULSE_DAILY_YIELD_TMP to bring the Package to its consistent state and initialisze the NULL Varray.
3. Create a After INSERT ROWLEVEL on MOTOPVS_OWN.MOTO_PVS_PULSE_DAILY_YIELD_TMP to get the ROWID of the newly inserted row.
4. Create a AFTER INSERT statement level on MOTOPVS_OWN.MOTO_PVS_PULSE_DAILY_YIELD_TMP and use the ROWID in the package VARRAY to insert that row in to mt_pulse_daily_yield_tmp table.
Then delete the Row in MOTOPVS_OWN.MOTO_PVS_PULSE_DAILY_YIELD_TMP after it is inserted in to mt_pulse_daily_yield_tmp table.
This should work. Let me know if it does not.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Edward King |
last post by:
Hi!
I am trying to achieve the following:
I have a number of help pages (in the format help_nn.php where nn=helpid).
I want to be able to open a particular help page by calling the function...
|
by: Tom |
last post by:
A question for gui application programmers. . .
I 've got some GUI programs, written in Python/wxPython, and I've got
a help button and a help menu item. Also, I've got a compiled file
made with...
|
by: Sarir Khamsi |
last post by:
Is there a way to get help the way you get it from the Python
interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the
module cmd.Cmd? I know how to add commands and help text to...
|
by: clintonG |
last post by:
Is there a document that explains the difference between the
Visual Studio .NET 2003 Combined Help Collection and the
MSDN Library for Visual Studio .NET 2003 or does someone
have comments...
|
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing...
|
by: d.warnermurray |
last post by:
I am doing a project for school that involves creating help files for a html
authoring tool.
If you could help me with answers to some questions it would really help.
1. What tasks do you expect...
|
by: tbatwork828 |
last post by:
If you were like me trying to figure out how to launch context
sensitive help topic by the context id, here is the link:
http://weblogs.asp.net/kencox/archive/2004/09/12/228349.aspx
and if...
|
by: Colin J. Williams |
last post by:
Python advertises some basic service:
C:\Python24>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
With...
|
by: Steve Teeples |
last post by:
Can someone point me to a document that clearly identifies the steps of
creating a good help system for an application? I have a test tool that I'd
like to add help to so that others will know how...
|
by: trunxnirvana007 |
last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
'UPGRADE_WARNING: Couldn't resolve...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |