oracle 存储过程使用

创建存储过程


create procedure WMSendObj(org in varchar2, dept in varchar2)
as
    cursor curss is (select distinct cno
                     from HR_ARC_DISPATCH_OBJ
                     where INCLUDEDOWN = 1
                       and COBJ = cobj);
    s_cno     varchar2(40);
    loopindex Integer;
begin
    open curss;
    loopindex := 20221103;
    loop
        fetch curss into s_cno;
        exit when curss%notfound;
        insert into HR_ARC_DISPATCH_OBJ
        values (loopindex, '1', s_cno, dept, '3', '1', '0', null, null, null, null, null, null, 1, 1, 1,
                to_date('2021-12-01 15:14:37', 'yyyy-mm-dd hh24:mi:ss'),
                to_date('2021-12-01 15:14:37', 'yyyy-mm-dd hh24:mi:ss'),
                1, 2);
        loopindex := loopindex + 1;
    end loop;
    commit;
    close curss;
end;


调用存储过程


call WMSendObj('123','123')

posted @ 2022-11-03 20:24  NewBumblebee  阅读(58)  评论(0)    收藏  举报