create or replace procedure V8_UPD_PostForeignCurrRights is
 
  cursor CURR is

    select distinct wusr_wegr_id from wusr where wusr_wegr_id is not null and wusr_name not like 'CashieringPost in foreign currency';

   cooo CURR%rowtype;

begin

delete from wusr where wusr_name like 'CashieringPost in foreign currency' and wusr_wegr_id is not null;

  for cooo in CURR loop
    
    insert into wusr values (seq_wusr.nextval, null, cooo.wusr_wegr_id, 'CashieringPost in foreign currency', 1); 

  end loop;

  exception
    when no_data_found then
      raise; --null;
    when others then
      raise; --null;  
end V8_UPD_PostForeignCurrRights;
/
