Welcome 微信登录

首页 / 数据库 / MySQL / Oracle存储过程之insert的使用,含游标的使用

Oracle存储过程之insert的使用,含游标的使用body部分:-- 获取指定计划的指定阶段的指定修改次数的计划类型编号和名称 by shiwei  --变更阶段使用
    procedure proc_sy_syjs_getAProChange(proID in jwxt.sy_syjs_audit.FProID%type,
                                              historyStageID in number,
                                              tab out t_cursor) is
      curStage number;
             begin
       
             curStage:=-1;
               select max(jt.fstageid) into curStage
                         from jwxt.SY_SYJS_PROITEM jt
                         where jt.fproid=proID
                               and jt.zt=1;
                               
                 
                       
                           if(curStage = 1) then
                                         -----初次变更时
                                 insert into jwxt.SY_SYJS_PROITEM( fproid,fstageid, fmodifyid, fcoursecode, fcoursename, fitemid, fitemname, ftype, fstyle, frequirement,
                                     flabmemnum, fgroupnum, fdevicename, fmodel, fhavenum, fobsonum, fbuynum, funitprice)
                                     select t.fproid,t.fstageid+1,0, t.fcoursecode,t.fcoursename,t.fitemid,t.fitemname,t.ftype,t.fstyle,t.frequirement,
                                              t.flabmemnum,t.fgroupnum,t.fdevicename,t.fmodel,t.fhavenum,t.fobsonum,t.fbuynum,t.funitprice
                                         
                                         from jwxt.SY_SYJS_PROITEM t
                                         where t.fproid=proID
                                         and t.fstageid="1"
                                         and t.zt="1";
                                         commit;
                                         
                                   else
                                              ----2次及以上  变更时 复制数据
                                              insert into jwxt.SY_SYJS_PROITEM( fproid,fstageid, fmodifyid, fcoursecode, fcoursename, fitemid, fitemname, ftype, fstyle, frequirement,
                                               flabmemnum, fgroupnum, fdevicename, fmodel, fhavenum, fobsonum, fbuynum, funitprice)
                                                  select t.fproid,t.fstageid,t.fmodifyid+1, t.fcoursecode,t.fcoursename,t.fitemid,t.fitemname,t.ftype,t.fstyle,t.frequirement,
                                                     t.flabmemnum,t.fgroupnum,t.fdevicename,t.fmodel,t.fhavenum,t.fobsonum,t.fbuynum,t.funitprice
                                                     
                                                 from jwxt.SY_SYJS_PROITEM t
                                                 where t.fmodifyid=(select max(mt.fmodifyid) from jwxt.SY_SYJS_PROITEM mt
                                                                           where mt.fproid=proID
                                                                              and mt.fstageid="2"
                                                                           and mt.zt="1"
                                                                           )
                                                 and t.fproid=proID
                                                 and t.fstageid="2"
                                                    and t.zt="1";
                                               commit;
                                       end if; 
                                         
                                          open tab for
                                                select t.FProTypeID, t.FProTypeName from jwxt.sy_syjs_audit t
                                         
                                               where FModifyID=(select max(t.fmodifyid) from jwxt.sy_syjs_proitem td
                                                                 where td.fproid=proID and td.fstageid=historyStageID
                                                                       and td.zt="1")
                                               and t.fproid=proID and t.fstageid=historyStageID  and t.zt="1";     
                                               
                                           
                                 
                             
      end;头文件:  procedure proc_sy_syjs_getAProChange(proID in jwxt.sy_syjs_audit.FProID%type,
                                              historyStageID in number,
                                              tab out t_cursor);Oracle LogMiner 安装和使用(9i or later)Oracle存储过程使用实例之update的使用相关资讯      Oracle存储过程  Oracle游标 
  • Oracle游标的使用方法  (今 13:57)
  • Java调用Oracle存储过程返回多条结  (04月29日)
  • Oracle中的存储过程简单应用  (04月10日)
  • Oracle存储过程拼接in语句 & 自定  (09月27日)
  • 【PL/SQL系列】Oracle存储过程使用  (04月23日)
  • Oracle存储过程及Java调用  (05/28/2015 20:29:33)
本文评论 查看全部评论 (0)
表情: 姓名: 字数