存储过程实例(二)

 

create or replace procedure neusoft_insemployee_id is

 cursor test_post_sort is

    select t.employee_code,t.post_sort_code from urp_exam.trans_data_post_sort t where t.employee_code not like '14%';

 v_empid varchar2(20);

 t_dataset test_post_sort%rowtype;

    BEGIN

           v_empid:='';

      for t_dataset in test_post_sort loop

           select b.employee_id into v_empid from urp_staff.t_stf_base b where b.delete_flag='0' and b.employee_code = t_dataset.employee_code;

           update urp_exam.trans_data_post_sort p set p.employee_id = v_empid where p.employee_code = t_dataset.employee_code;

      end loop;

    commit;

end neusoft_insemployee_id;

你可能感兴趣的:(存储过程)