日期:2014-05-16  浏览次数:20462 次

执行出生日期变更记录写入

create or replace procedure do_update
is
  OutputFile UTL_FILE.FILE_TYPE;
  v_result varchar2(2048);
  v_rfid_num number;
  cursor r is
    select distinct h.rfid as rfid from his_animal_info h;
  thedata r%rowtype;
begin

v_rfid_num := 0;
  open r;
  loop
    fetch r
      into thedata;
    v_rfid_num := v_rfid_num + 1;
    OutputFile := utl_file.fopen('background_dump_dest','birthdayhis.log','a');
    utl_file.putf(OutputFile,v_rfid_num);
    utl_file.fflush(OutputFile);
    utl_file.fclose(OutputFile);
    
    get_BirthdayHis_By_RFID(thedata.rfid,v_result);

    if (v_result is not null) then
      update tbl_animal_info a
         set a.birthday_his = v_result
       where a.rfid = thedata.rfid;
      commit;
    end if;

  end loop;
  
end;