ora-04091 table is Mutating-

后端 未结 2 496
灰色年华
灰色年华 2021-01-27 06:50

I\'m using a function which compares all the columns in Table 1 and Table 2 and returns \'Y\' or \'N\'. Based on that, I will update my Table 1.

But when I run the merge

2条回答
  •  无人共我
    2021-01-27 07:31

    Chade i tried this Option it didnt throw me any error.

    CREATE OR REPLACE PROCEDURE updatetabble1 AS
        BEGIN
            MERGE
            INTO Table1 DBC
            USING  (            Select ename from
                (
                Select ename
                from
                    (
                    Select ename, column1||Column2||Column3 from table1
                    union
                    Select ename, column1||Column2||Column3 from table2 
                    ) 
                ) 
            GROUP BY ename HAVING count(*) > 1
            ) TBL_MAIN
                     ON ( DBC.empname = TBL_MAIN.empname)
                    WHEN MATCHED THEN
     UPDATE SET DBC.DATA_CHANGED = 'Y';
    COMMIT;     
    END updatetabble1;
    

提交回复
热议问题