生年月日変更記録書き込みの実行
1006 ワード
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;