oracle 之存储过程 begin ...... ; ...... end

打印 上一主题 下一主题

主题 869|帖子 869|积分 2607

点击查看代码
  1. begin
  2.         merge into ly_yjs_hxsj.T_XSGL_XSXX_CZRZ rz
  3.         using ( select a.XS_ID xsid, xh, xm, '02' as bglx,'修改学生:'||xm||':学位操作撤销学位证书号,原学位证书号:'|| BJYZSBH || '改为:'|| a.JYZSH as bgnr, #{editor} as czrzh,
  4.         #{editor} as czrxm ,'' as czip from (
  5.         <foreach collection="data" item="item" separator="union">
  6.             select #{item.studentId} XS_ID, #{item.studentCompletionNumber,jdbcType=VARCHAR} JYZSH from dual
  7.         </foreach>
  8.         ) a join LY_YJS_HXSJ.T_BYGL_XSBYJG byjg on byjg.XS_ID = a.XS_ID and byjg.BYLXM = '08' and byjg.GDMC is null
  9.         join LY_YJS_HXSJ.T_XSGL_XSXX_XJXX xjxx on xjxx.XS_ID = byjg.XS_ID
  10.         <where>
  11.             <if test=" studentIdOrName != null and studentIdOrName != ''">and (instr(xjxx.XM, #{studentIdOrName}) > 0 or instr(xjxx.XS_ID, #{studentIdOrName}) > 0)</if>
  12.             <if test="studentCultureLevelCode != null and studentCultureLevelCode != ''">and xjxx.PYCCM = #{studentCultureLevelCode}</if>
  13.             <if test="degreeClassify != null and degreeClassify != ''">and xjxx.XWLXM = #{degreeClassify}</if>
  14.             <if test="educationCategory != null and educationCategory != ''">and xjxx.JYLXM = #{educationCategory}</if>
  15.             <if test="studyModeCode != null and studyModeCode != ''">and xjxx.XXFSM = #{studyModeCode}</if>
  16.         </where>
  17.          ) prz on (prz.xsid = 'T_BYGL_XSBYJG')
  18.         when not matched then
  19.         insert  (czrzid, xsid, xh, xm,bglx, bgnr, bgsj, czrzh, czrxm,czip) values(
  20.         sys_guid(),prz.xsid,prz.xh, prz.xm,prz.bglx,prz.bgnr,sysdate,prz.czrzh,prz.czrxm,prz.czip
  21.         );
  22.         merge into LY_YJS_HXSJ.T_XSGL_XSXX_XJXX xjxx using (
  23.             select a.XS_ID, a.JYZSH from (
  24.                 <foreach collection="data" item="item" separator="union">
  25.                     select #{item.studentId} XS_ID, #{item.studentCompletionNumber,jdbcType=VARCHAR} JYZSH from dual
  26.                 </foreach>
  27.             ) a join LY_YJS_HXSJ.T_BYGL_XSBYJG byjg on byjg.XS_ID = a.XS_ID and byjg.BYLXM = '08' and byjg.GDMC is null
  28.             join LY_YJS_HXSJ.T_XSGL_XSXX_XJXX xjxx on xjxx.XS_ID = byjg.XS_ID
  29.             <where>
  30.                 <if test=" studentIdOrName != null and studentIdOrName != ''">and (instr(xjxx.XM, #{studentIdOrName}) > 0 or instr(xjxx.XS_ID, #{studentIdOrName}) > 0)</if>
  31.                 <if test="studentCultureLevelCode != null and studentCultureLevelCode != ''">and xjxx.PYCCM = #{studentCultureLevelCode}</if>
  32.                 <if test="degreeClassify != null and degreeClassify != ''">and xjxx.XWLXM = #{degreeClassify}</if>
  33.                 <if test="educationCategory != null and educationCategory != ''">and xjxx.JYLXM = #{educationCategory}</if>
  34.                 <if test="studyModeCode != null and studyModeCode != ''">and xjxx.XXFSM = #{studyModeCode}</if>
  35.             </where>
  36.         ) t on (t.XS_ID = xjxx.XS_ID)
  37.         when matched then update set xjxx.BJYZSBH = t.JYZSH
  38.         ;
  39.         end;
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

温锦文欧普厨电及净水器总代理

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表