title: Whats wrong with this PLSQL code block
body: <p>The code block below is not running when executed from a batch file. It just hangs (nothing happens). It sits there  for hours. I am unable to track what the problem is or how to debug this. Please help. </p>
  
  <pre><code>declare
  v_personrefid varchar2(50);
  v_hiredt date;
  v_loaddt date;
  v_personid number;
  v1_personrefid varchar2(50);
  v_seq number :=0;
  
  cursor get_row is
  select distinct personrefid from ARCHIVE_PERSON;
  
  cursor get_row1 is
  select 
  personrefid, 
  hiredt,
  loaddt,
  personid
  from 
  ARCHIVE_PERSON 
  where 
  personrefid = v_personrefid 
  order by hiredt, loaddt;
  
  begin
  
  v_seq:=0;
  open Get_row;
  loop
  fetch get_row into v_personrefid ;
  exit when get_row%notfound;
  
  begin
  
  open get_row1;
  loop
  fetch get_row1 into v1_personrefid, v_hiredt, v_loaddt, v_personid;
  exit when get_row1%NOTFOUND;
  
  v_seq:= v_seq+1;
  
  update ARCHIVE_PERSON 
  set version = v_seq 
  where 
  personrefid = v1_personrefid and 
  personid =  v_personid and 
  hiredt = v_hiredt and 
  loaddt = v_loaddt;
  
  commit;
  end loop;
  
  v_seq:=0;
  
  close get_row1;
  end;
  end loop;
  v_seq:=0;
  close get_row;
  
  end;
  </code></pre>