ORA-04091: Table xx has changed, the trigger/function cannot read it ____ function

Source: Internet
Author: User
Tags modifier

/**

* * Name: Modify single, QC Sync trigger

* * Function: Modify the single modified, QC information synchronization to provide the foreground display

**created by FANQD @ 2010/12/26

**/

Create or Replace Trigger MODIFYSYNCHRONIZEQC

After update on tb_support_modify

Referencing old as old new as NewValue

For each row

Declare

VAR_OUT1 VARCHAR (255);

Var_out2 VARCHAR (255);

BEGIN

SELECT u.objname into var_out1 from Tb_support_userinfo u WHERE u.objno=:newvalue.modifier;

SELECT v.module_names into Var_out2 from vw_modify_active v WHERE v.modify_id=:newvalue.modify_id;

UPDATE default_ Quality Policy Import Test _. req@qc114 T

SET t.rq_user_25 = ' Modify Reason: ' | |:newvalue.modify_reason| | ' /n Modification Note: ' | |:newvalue.modify_desc| | ' /n Modify file and path: ' | |:newvalue.modify_file| |:newvalue.program_path| | ' /n Modify table structure information: ' | |:newvalue.table_modify

,--Modify information

T.rq_user_26 =: Newvalue.self_test_desc,--unit Test record

t.rq_user_27 = ' Test Essentials and Recommendations: ' | |:newvalue.test_suggestion| | ' /n Online steps: ' | |:newvalue.publish_desc,

--Test points and on-line steps

T.rq_req_type = Decode (: newvalue.test_type,1, ' field test ', ' Test room test '),

T.rq_user_04 = VAR_OUT1,--Modified person

t.rq_user_01 = var_out2--Module

WHERE t.rq_user_23 =: newvalue.product_id

and t.rq_user_22 =: newvalue.modify_num;

End Modifysynchronizeqc;

When executing the error, the following:

ORA-04091: Table xx has changed, the trigger/function cannot read it

Problem Reason:

In the process: newvalue.modify_id again to check the target table, this action is considered illegal by Oracle.

The record row of the target table is updated without having to query the target record line by ID. This action was considered illegal by Oracle.

/**

* * Name: Modify single, QC Sync trigger

* * Function: Modify the single modified, QC information synchronization to provide the foreground display

**created by FANQD @ 2010/12/26

**/

Create or Replace Trigger MODIFYSYNCHRONIZEQC

After update on tb_support_modify

Referencing old as old new as NewValue

For each row

Declare

VAR_OUT1 VARCHAR (255);

Var_out2 VARCHAR (255);

BEGIN

SELECT u.objname into var_out1 from Tb_support_userinfo u WHERE u.objno=:newvalue.modifier;

SELECT Wmsys. Wm_concat (V.module_name) into the var_out2 from Tb_support_module v WHERE v.parent_id=:newvalue.modify_id;

UPDATE default_ Quality Policy Import Test _. req@qc114 T

SET t.rq_user_25 = ' Modify Reason: ' | |:newvalue.modify_reason| | ' /n Modification Note: ' | |:newvalue.modify_desc| | ' /n Modify file and path: ' | |:newvalue.modify_file| |:newvalue.program_path| | ' /n Modify table structure information: ' | |:newvalue.table_modify,--Modify information

T.rq_user_26 =: Newvalue.self_test_desc,--unit Test record

t.rq_user_27 = ' Test Essentials and Recommendations: ' | |:newvalue.test_suggestion| | ' /n Online steps: ' | |:newvalue.publish_desc,

--Test points and on-line steps

T.rq_req_type = Decode (: newvalue.test_type,1, ' field test ', ' Test room test '),

T.rq_user_04 = VAR_OUT1,--Modified person

t.rq_user_01 = var_out2--Module

WHERE t.rq_user_23 =: newvalue.product_id

and t.rq_user_22 =: newvalue.modify_num;

End Modifysynchronizeqc;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.