我在一个存储过程中会用到merge,但由于需要我要使用2次merge。
现在问题来了,经过测试发现用一个用户下,先执行的merge语句可以正常,第二个merge语句就没有起到作用,但是也不会报错。下面是我的存储过程
CREATE OR REPLACE PROCEDURE PROCEDURE1 AS 
BEGIN
    merge into w_yusuanaf001 d        
  using w_yusuanab05 c on (d.name_entity=c.name_entity
                          and d.code_year=c.code_year                       
                          and d.name_month=c.name_month
                          )      
 when NOT MATCHED then         
     insert(code_entity,name_entity,code_meatrics,name_meatrics,code_dataattr,name_dataattr,code_year,code_month,name_month
     ,code_dimanalhelp,name_dimanalhelp,value)          
     values(c.code_entity,c.name_entity,c.code_meatrics,c.name_meatrics,c.code_dataattr,c.name_dataattr,
     c.code_year,c.code_month,c.name_month,c.code_dimanalhelp,c.name_dimanalhelp,c.value)         
     where  c.code_meatrics ='6601' and c.code_dimanalhelp='Z0102';
     
     commit;
     
       merge into w_yusuanaf001 a        
  using w_yusuanab03 b on (a.name_entity=b.name_entity
                          and a.code_year=b.code_year
                          and a.code_month=b.code_month
                          )      
 when NOT MATCHED then         
     insert(code_entity,name_entity,code_meatrics,name_meatrics,code_dataattr,name_dataattr,code_year,code_month,name_month
     ,code_dimanalhelp,name_dimanalhelp,value)          
     values(b.code_entity,b.name_entity,b.code_meatrics,b.name_meatrics,b.code_dataattr,b.name_dataattr,
     b.code_year,b.code_month,b.name_month,b.code_dimanalhelp,b.name_dimanalhelp,b.value)         
     where b.code_dimanalhelp ='Z0102' and b.code_meatrics ='6401';
     
     commit;
END PROCEDURE1;我自己测试过 如果我在plsql中执行第一个merge,然后退出再进去执行第二个merge这样是可以的。
我估计是有什么资源没有释放什么的。
请问要怎么解决呢?