在 plsql 中执行其余部分时回滚整个块

Rollback an entire block while executing the rest in plsql

我有一个包,它正在为工作职位和位置执行不同的插入和更新 tables.Something,例如:

Create or replace package body pack_name 
as 
procedure proc
as

----Posistion Block

Begin

  Begin

  insert into xx_pos_table
  select * 
  from xx_i_pos_table;

  exception when others then
  end;

  Begin

  insert into xx_pos_tl_table
  select * from xx_i_pos_tl_table;

  exception when others then
  end;

  Begin

  Update xx_pos_extra
  set err_msg =Null

  exception when others then
  end;

end;

---Job block
   Begin

  Update xx_job_extra
  set err_msg =Null

  exception when others then
  end;

-- Loc block
   Begin

  Update xx_loc_extra
  set err_msg =Null

  exception when others then
  end;
end;
end;

现在我希望如果在 xx_pos_extra 中插入数据时在位置块中出现错误,那么只应回滚位置块和来自 xx_pos_table、xx_pos_tl_table 的数据并且不应输入 xx_pos_extra。但是应该执行其余的块(作业和位置)。

创建一个保存点到 rollback to 如果发生这样的异常:

---Job block

  begin
  SAVEPOINT p_rollback;
      Update xx_job_extra
      set err_msg =Null

  exception when others then
      rollback to p_rollback;
  end;

-- Loc block