zoukankan      html  css  js  c++  java
  • 数据库存储过程范例

    create or replace procedure p_do_staff_qualify(i_get_type in varchar2,
    i_org_no in varchar2,
    i_staff_no in varchar2,
    i_apply_occu_id in varchar2,
    iapply_occu_name in varchar2,
    i_apply_work_type_id in varchar2,
    i_apply_work_type_name in varchar2,
    i_apply_title_id in varchar2,
    i_apply_title_name in varchar2,
    i_create_user_id in varchar2,
    o_rtnstr out varchar2,
    o_rtninfo out varchar2) is
    ----邵松
    --i_org_no 登录人所在机构编码
    --i_get_type 操作动作
    --i_staff_no 人员编码
    --i_apply_occu_id 申请职业编码
    --i_apply_work_type_id 申请监考工种编码
    --i_apply_title_id 申请职称编码
    --i_create_user_id 创建人员编码

    v_num int := 0;
    v_ber int := 0;
    v_org_level varchar2(100);
    begin
    o_rtnstr := 'false';
    o_rtninfo := '操作失败';
    if i_create_user_id = '' or i_create_user_id is null then
    o_rtninfo := '非法用户';
    return;
    end if;

    select count(*)
    into v_num
    from t_f_user t
    where t.user_id = i_create_user_id
    and t.is_valid = '0';

    if v_num < 1 then
    o_rtninfo := '不存在的操作用户';
    return;
    end if;
    select org_level into v_org_level from t_f_org where org_no = i_org_no;
    ------- 考评员操作
    --考评员资格申请
    if v_org_level = '3' then
    if i_get_type = 'staff' then
    select count(*)
    into v_ber
    from t_f_staff_qualify
    where staff_no = i_staff_no
    and apply_occu_id = i_apply_occu_id
    and apply_work_type_id = i_apply_work_type_id
    and apply_title_id = i_apply_title_id;
    if v_ber >= 1 then
    o_rtninfo := '该员工以有该职业考评员资格';
    elsif v_ber < 1 then

    insert into t_f_staff_qualify
    (staff_no,
    apply_occu_id,
    apply_occu_name,
    apply_work_type_id,
    apply_work_type_name,
    apply_title_id,
    apply_title_name,
    verify_state,
    create_time,
    create_user_id)
    values
    (i_staff_no,
    i_apply_occu_id,
    iapply_occu_name,
    i_apply_work_type_id,
    i_apply_work_type_name,
    i_apply_title_id,
    i_apply_title_name,
    '00',
    sysdate,
    i_create_user_id);
    commit;
    o_rtninfo := '该员工申请成功!';


    end if;
    end if;

    elsif v_org_level = '2' then
    -- 鉴定中心审核对考评员资格进行审核
    --通过鉴定中心审核
    if i_get_type = 'verifyIsPass' then
    update t_f_staff_qualify
    set verify_state = '10',
    verify_opinion_2 = '通过',
    verify_time_2 = sysdate
    where verify_state = '00'
    and staff_no = i_staff_no
    and apply_occu_id = i_apply_occu_id
    and apply_work_type_id = i_apply_work_type_id
    and apply_title_id = i_apply_title_id;
    commit;
    o_rtninfo := '鉴定中心审核通过';

    --没通过鉴定中心审核
    elsif i_get_type = 'verifyIsUnPass' then
    update t_f_staff_qualify
    set verify_state = '11',
    verify_opinion_2 = '所学专业不符',
    verify_time_2 = sysdate
    where verify_state = '00'
    and staff_no = i_staff_no
    and apply_occu_id = i_apply_occu_id
    and apply_work_type_id = i_apply_work_type_id
    and apply_title_id = i_apply_title_id;
    commit;
    o_rtninfo := '鉴定中心审核没通过';
    end if;
    elsif v_org_level = '1' then
    -- 鉴定指导中心审核对考评员资格进行审核
    --通过鉴定指导中心审核
    if i_get_type = 'verifyIsPass' then
    update t_f_staff_qualify
    set verify_state = '20',
    verify_opinion_1 = '通过',
    verify_time_1 = sysdate
    where verify_state = '10'
    and staff_no = i_staff_no
    and apply_occu_id = i_apply_occu_id
    and apply_work_type_id = i_apply_work_type_id
    and apply_title_id = i_apply_title_id;
    commit;
    o_rtninfo := '鉴定指导中心审核通过';

    --没通过鉴定指导中心审核
    elsif i_get_type = 'verifyIsUnPass' then
    update t_f_staff_qualify
    set verify_state = '21',
    verify_opinion_1 = '所学专业不符',
    verify_time_1 = sysdate
    where verify_state = '10'
    and staff_no = i_staff_no
    and apply_occu_id = i_apply_occu_id
    and apply_work_type_id = i_apply_work_type_id
    and apply_title_id = i_apply_title_id;
    commit;
    o_rtninfo := '鉴定指导中心审核没通过';

    end if;
    else
    o_rtninfo := '用户等权限太低,不能操作!';
    end if;
    commit;


    ---------网管操作
    --网管员资质申请

    if v_org_level = '3' then
    if i_get_type = 'webmaster' then
    select count(*)
    into v_ber
    from t_f_staff_qualify
    where staff_no = i_staff_no
    and apply_title_id = '004';
    if v_ber >= 1 then
    o_rtninfo := '该员工已经是网络管理员!';
    elsif v_ber < 1 then

    insert into t_f_staff_qualify
    (staff_no,
    apply_title_id,
    apply_title_name,
    verify_state,
    create_time,
    create_user_id)
    values
    (i_staff_no,
    i_apply_title_id,
    i_apply_title_name,
    '0',
    sysdate,
    i_create_user_id);
    commit;
    o_rtninfo := '该员工申请成功!';


    end if;
    end if;

    elsif v_org_level = '2' then
    -- 鉴定中心对网管员资质进行审核
    --通过鉴定中心审核
    if i_get_type = 'webmasterIsPass' then
    update t_f_staff_qualify
    set verify_state = '1',
    verify_opinion_2 = '通过',
    verify_time_2 = sysdate
    where verify_state = '0'
    and staff_no = i_staff_no;
    commit;
    o_rtninfo := '鉴定中心审核通过';

    --没通过鉴定中心审核
    elsif i_get_type = 'webmasterIsUnPass' then
    update t_f_staff_qualify
    set verify_state = '2',
    verify_opinion_2 = '文化程度太低',
    verify_time_2 = sysdate
    where verify_state = '0'
    and staff_no = i_staff_no;
    commit;
    o_rtninfo := '鉴定中心审核没通过';
    end if;
    elsif v_org_level = '1' then
    -- 鉴定指导中心对网管员资质进行审核
    --通过鉴定指导中心审核
    if i_get_type = 'webmasterIsPass' then
    update t_f_staff_qualify
    set verify_state = '3',
    verify_opinion_1 = '通过',
    verify_time_1 = sysdate
    where verify_state = '1'
    and staff_no = i_staff_no;
    commit;
    o_rtninfo := '鉴定指导中心审核通过';

    --没通过鉴定指导中心审核
    elsif i_get_type = 'webmasterIsUnPass' then
    update t_f_staff_qualify
    set verify_state = '4',
    verify_opinion_1 = '文化程度太低',
    verify_time_1 = sysdate
    where verify_state = '1'
    and staff_no = i_staff_no;
    commit;
    o_rtninfo := '鉴定指导中心审核没通过';

    end if;
    else
    o_rtninfo := '用户等权限太低,不能操作!';
    end if;
    commit;
    end p_do_staff_qualify;

  • 相关阅读:
    dfs
    spring框架(3)— spring集合类的注入
    android入门 — Service
    android入门 — 多线程(一)
    android入门 — Activity启动模式
    android入门 — Activity生命周期
    android入门 — ProgressDialog/DatePickerDialog/TimePickerDialog
    Numpy入门
    Numpy入门
    Numpy入门
  • 原文地址:https://www.cnblogs.com/shaosong/p/4577286.html
Copyright © 2011-2022 走看看