读书人

依据rfid获取出生日期变更记录

发布时间: 2012-07-22 19:31:15 作者: rapoo

根据rfid获取出生日期变更记录

create or replace procedure get_BirthdayHis_By_RFID(i_rfid in varchar2,o_birthday_his out varchar2) isv_birthdayLast date;v_birthday date;v_updateTime date;v_result varchar2(2048);cursor r isselect h.birthday as birthday       ,case when h.update_time is null then h.his_time else h.update_time end as updateTime        ,decode(h.upt_user, null, decode(e.type, '112', e.name , p.name), h.upt_user) as reader   from his_animal_info h,tbl_people_manager p,tbl_enterprise ewhere h.birthday is not null and h.rfid = i_rfid  and h.card_id = p.card_id(+)   and h.card_id = e.card_id(+)     order by h.update_time;thedata r%rowtype;begin  open r;  loop    fetch r      into thedata;    exit when r%notfound;    v_birthday := thedata.birthday;    v_updateTime := thedata.updateTime;    if(v_birthday <> v_birthdayLast) then        v_result := v_result||to_char(v_updateTime,'yyyy-mm-dd hh24:mi:ss')||chr(10)||'修改人:'||thedata.reader||chr(10)||'出生日期:'||to_char(v_birthday,'yyyy-mm-dd')||chr(10)||'-------------'||chr(10);/*字符串中换行用chr(10)*/    end if;    v_birthdayLast := v_birthday;  end loop;  o_birthday_his := v_result;end;

读书人网 >其他数据库

热点推荐