CREATE OR REPLACE PROCEDURE "YLQXSCXKESL_GGXKZ_TO_QB" (
                                              xkzbh_idIn in varchar2,
                                              bgid_idIn in varchar2,
                                              fzrqIn in varchar2,
                                              yxqzIn in varchar2,
                                              flag   out varchar2) is

v_raise EXCEPTION ;
  V_sqid_q  VARCHAR2(32);
  V_sqid_h  VARCHAR2(32);
  V_xkzbh    VARCHAR2(100);
  V_qbid     VARCHAR2(32);
  V_fzrqIn   VARCHAR2(8);
  V_yxqzIn   VARCHAR2(8);

V_QYMC    INTEGER;
  V_ZS      INTEGER;
 -- V_ryxx    INTEGER; --人员信息
  --V_FDDBR   INTEGER;
  --V_QYFZR   INTEGER;
  V_ryxx1    INTEGER; --法定代表人人员信息
  V_ryxx2    INTEGER; --企业负责人人员信息
  V_SCFW    INTEGER;

-- V_QYSCDZ  INTEGER;
  V_QYSCDZ1  INTEGER; -- SCDZFWZXBG
  V_QYSCDZ2  INTEGER; -- SCDZWZXBG

-- V_SCCP    INTEGER;
  V_SCCP1    INTEGER;-- JSSCCP
  V_SCCP2    INTEGER;-- ZJSSCCP

V_BS    INTEGER;  -- 0 长流程
                    -- 1 短流程

V_FRXGZM          INTEGER;
  V_FZRXGZM         INTEGER;

V_length        INTEGER;         -- 求长度
  V_name2         VARCHAR2(100);   -- 用于存储替换后的字段信息
begin

----------------更新------医疗器械生产许可证-----------真实数据  状态------结束--------------
  select t.sqid into V_sqid_q from gg_xkz_ylqxscxkesl t where xkzbh = xkzbh_idIn  and czzt = 'V' and xkzzt = '0'; -- 查询出许可证表中 元数据为V的状态的ID  V_xkzid_q 表示原来的ID
  select t.sqid into V_sqid_h from gg_xkz_ylqxscxkesl t where xkzbh = xkzbh_idIn  and czzt = 'T' and xkzzt = '0' and sqid = bgid_idIn; -- 查询出许可证表中 元数据为T的状态的ID  V_xkzid_h 表示插入后的ID
  select  fzrqIn  into V_fzrqIn from dual;
  select  yxqzIn  into V_yxqzIn from dual;

-- 定义变更变量
  select  0  into V_BS from dual;

update GG_XKZ_YLQXSCXKESL set DZRQ=to_char(sysdate, 'yyyyMMdd')  where sqid=V_sqid_h;

-- select  t.xkzbh into V_xkzbh from gg_xkz_ylqxscxkesl t where xkzbh = xkzbh_idIn  and czzt = 'V' and xkzzt = '0'; -- 查询出许可证表中 元数据为V的状态的ID  V_xkzid_q 表示原来的ID
  select  t.xkzbh into V_xkzbh from gg_xkz_ylqxscxkesl t where xkzbh = xkzbh_idIn and czzt = 'V'; -- 查询出许可证表中 许可证编号作为唯一条件
  update gg_xkz_ylqxscxkesl  set   czzt = 'I' where  sqid = V_sqid_q  and czzt = 'V' ;
  update gg_xkz_ylqxscxkesl  set   czzt = 'V' where  sqid = V_sqid_h  and czzt = 'T' ;

-- 根据修改证面信息 更新人员法定代表人和企业负责人(后加)
  --判断法人是否被修改
  select count(1) into V_FRXGZM from GG_XKZ_YLQXSCXKESL_RYXX r where r.xm=(
      select g.fddbr from GG_XKZ_YLQXSCXKESL g where g.sqid = V_sqid_h
  ) and r.sqid = V_sqid_h and r.rylx = '0';

--判断负责人是否被修改
  select count(1) into V_FZRXGZM from GG_XKZ_YLQXSCXKESL_RYXX r where r.xm=(
      select g.qyfzr from GG_XKZ_YLQXSCXKESL g where g.sqid = V_sqid_h
  ) and r.sqid = V_sqid_h and r.rylx = '1';

if V_FRXGZM = 0 then
    update GG_XKZ_YLQXSCXKESL_RYXX set XM = ( select FDDBR from GG_XKZ_YLQXSCXKESL  where sqid = V_sqid_h )  where sqid = V_sqid_h and rylx = '0' ;
  end if;

if V_FZRXGZM = 0 then
     update GG_XKZ_YLQXSCXKESL_RYXX set XM = ( select QYFZR from GG_XKZ_YLQXSCXKESL  where sqid = V_sqid_h )  where sqid = V_sqid_h and rylx = '1' ;
  end if;

----------------更新------医疗器械生产许可证-----------真实数据  状态--------结束-------------

----------------插入------医疗器械生产许可信息全表------------------开始-------------

-- 查询出全表ID 根据xkzbh 字段查出全表ID 用于操作子表
 -- select qbid into V_qbid from xzxk_ylqxscxkesl_xx_qb qb where  qb.xkzbh = V_xkzbh  and czzt = 'V';
  select qbid into V_qbid from xzxk_ylqxscxkesl_xx_qb qb where  qb.xkzbh = V_xkzbh  ;
        SELECT COUNT(t.SQBGSXDM)
          into V_QYMC
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'QYMC'
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_ZS
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'ZS'
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_ryxx1
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'FDDBR'
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_ryxx2
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where  t.SQBGSXDM = 'QYFZR'
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_SCFW
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'SCFW'
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_QYSCDZ1
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'SCDZFWZXBG'
           AND t.sqid = bgid_idIn;  --  长

SELECT COUNT(t.SQBGSXDM)
          into V_QYSCDZ2
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where  t.SQBGSXDM = 'SCDZWZXBG' -- 短
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_SCCP1
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'JSSCCP'   -- 短
           AND t.sqid = bgid_idIn;

SELECT COUNT(t.SQBGSXDM)
          into V_SCCP2
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where  t.SQBGSXDM = 'ZJSCCP' --长
           AND t.sqid = bgid_idIn;

-- 更新全表信息
  -- 更新企业名称

if V_QYMC > 0 then
    update xzxk_ylqxscxkesl_xx_qb
     set( qymc , sqid ) =
     ( select qymc, bgid_idIn from GG_XKZ_YLQXSCXKESL where sqid = V_sqid_h and czzt = 'V')
     where qbid = V_qbid ;

select 1 into V_BS from dual ;
    else
        update  xzxk_ylqxscxkesl_xx_qb set  sqid  = V_sqid_h  where QBID = V_qbid ;
    end if;
  -- where xkzbh = V_xkzbh;

--更新全表住所
          SELECT COUNT(t.SQBGSXDM)
          into V_ZS
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'ZS'
           AND t.sqid = V_sqid_h;

if V_ZS>0 then
          update xzxk_ylqxscxkesl_xx_qb
             set (ZSDZQX, ZSDZJD, ZSDZ, ZSYB, ZSDH) =
                 (select ZSQX, ZSJD, ZSDZ, ZSYB, ZSDH
                    from xzxk_ylqxscxkesl_bg_zs z
                   where z.sqid = V_sqid_h and z.bgqhbs='2')  where qbid = V_qbid ;

select 1 into V_BS from dual ;
          end if;

--更新全表生产范围
          SELECT COUNT(t.SQBGSXDM)
          into V_SCFW
          FROM XZXK_YLQXSCXKESL_BG_SX t
         where t.SQBGSXDM = 'SCFW'
           AND t.sqid = V_sqid_h;

if V_SCFW > 0 then
          update xzxk_ylqxscxkesl_xx_qb
             set SCFW =
                 (select SCFW from xzxk_ylqxscxkesl_bg_sq z where z.sqid = V_sqid_h)  where qbid = V_qbid ;

select 1 into V_BS from dual ;
          end if;

--更新生产地址  -- 长流程V_BS  不赋值
        SELECT COUNT(t.SQBGSXDM)
        into V_QYSCDZ1
        FROM XZXK_YLQXSCXKESL_BG_SX t
       where ( t.SQBGSXDM = 'SCDZFWZXBG')
         AND t.sqid = V_sqid_h;

if V_QYSCDZ1 > 0 then
            update xzxk_ylqxscxkesl_xx_qb
               set (SCDZ, SCDZYB, SCDZDH) =
                   (select wm_concat(JTDZ), wm_concat(YB), wm_concat(LXDH)
                    from xzxk_ylqxscxkesl_bg_scdz z
                   where z.sqid = V_sqid_h and z.bgqhbs = '2')  where qbid = V_qbid ;
        end if;

SELECT COUNT(t.SQBGSXDM)
        into V_QYSCDZ2
        FROM XZXK_YLQXSCXKESL_BG_SX t
       where ( t.SQBGSXDM = 'SCDZWZXBG')
         AND t.sqid = V_sqid_h;

if V_QYSCDZ2 > 0 then
            update xzxk_ylqxscxkesl_xx_qb
               set (SCDZ, SCDZYB, SCDZDH) =
                   (select wm_concat(JTDZ), wm_concat(YB), wm_concat(LXDH)
                    from xzxk_ylqxscxkesl_bg_scdz z
                   where z.sqid = V_sqid_h and z.bgqhbs = '2')  where qbid = V_qbid ;

select 1 into V_BS from dual ;
        end if;

--1.1.2 住所
    if V_ZS > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_ZS', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_ZS where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_ZS where qbid = V_qbid;
        insert into XZXK_YLQXSCXKESL_XX_ZS
          (bzj,   QBID,   sqid, zsqx, zsjd, zsdz, zsyb, zsdh, instnum, lastdate, datexc)
        select
      sys_guid(), V_qbid, sqid, zsqx, zsjd, zsdz, zsyb, zsdh, f_getslbs(),sysdate,'11'
          from GG_XKZ_YLQXSCXKESL_ZS
          where  sqid = V_sqid_h ;
     select 1 into V_BS from dual ;
    else
        update  XZXK_YLQXSCXKESL_XX_ZS set  sqid  = V_sqid_h  where QBID = V_qbid ;
    end if;
  --1.1.3 人员信息
    if V_ryxx1 > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_RYXX', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_RYXX where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_RYXX where qbid = V_qbid and rylx = '0';
        insert into XZXK_YLQXSCXKESL_XX_RYXX
         (bzj,    QBID,    sqid, rylx, xm, zjlx, zjhm, zc, zw, xl, instnum, lastdate, datexc)
        select
      sys_guid(), V_qbid,  sqid, rylx, xm, zjlx, zjhm, zc, zw, xl, f_getslbs(),sysdate,'11'
          from GG_XKZ_YLQXSCXKESL_RYXX
          where sqid = V_sqid_h and rylx = '0';
        select 1 into V_BS from dual ;
    else
        update  XZXK_YLQXSCXKESL_XX_RYXX set  sqid  = V_sqid_h  where QBID = V_qbid and rylx = '0';
    end if;

if V_ryxx2 > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_RYXX', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_RYXX where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_RYXX where qbid = V_qbid and rylx = '1';
        insert into XZXK_YLQXSCXKESL_XX_RYXX
         (bzj,    QBID,    sqid, rylx, xm, zjlx, zjhm, zc, zw, xl, instnum, lastdate, datexc)
        select
      sys_guid(), V_qbid,  sqid, rylx, xm, zjlx, zjhm, zc, zw, xl, f_getslbs(),sysdate,'11'
          from GG_XKZ_YLQXSCXKESL_RYXX
          where sqid = V_sqid_h and rylx = '1';
        select 1 into V_BS from dual ;
    else
        update  XZXK_YLQXSCXKESL_XX_RYXX set  sqid  = V_sqid_h  where QBID = V_qbid and rylx = '1';
    end if;

--1.1.4 生产地址信息
     if V_QYSCDZ1 > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_SCDZ', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_SCDZ where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_SCDZ where qbid = V_qbid;
              insert into XZXK_YLQXSCXKESL_XX_SCDZ
               (bzj,  QBID,   sqid, jtdz, gb, szsf, szqx, szjd, lxr, lxdh, yb, dzyx, instnum, lastdate, datexc)
              select
          sys_guid(), V_qbid, sqid, jtdz, gb, szsf, szqx, szjd, lxr, lxdh, yb, dzyx, f_getslbs(),sysdate,'11'
                from GG_XKZ_YLQXSCXKESL_SCDZ
                where sqid = V_sqid_h ;
    else
        update  XZXK_YLQXSCXKESL_XX_SCDZ set  sqid  = V_sqid_h  where QBID = V_qbid ;
    end if;

if V_QYSCDZ2 > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_SCDZ', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_SCDZ where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_SCDZ where qbid = V_qbid;
              insert into XZXK_YLQXSCXKESL_XX_SCDZ
               (bzj,  QBID,   sqid, jtdz, gb, szsf, szqx, szjd, lxr, lxdh, yb, dzyx, instnum, lastdate, datexc)
              select
          sys_guid(), V_qbid, sqid, jtdz, gb, szsf, szqx, szjd, lxr, lxdh, yb, dzyx, f_getslbs(),sysdate,'11'
                from GG_XKZ_YLQXSCXKESL_SCDZ
                where sqid = V_sqid_h ;
    select 1 into V_BS from dual ;
    else
        update  XZXK_YLQXSCXKESL_XX_SCDZ set  sqid  = V_sqid_h  where QBID = V_qbid ;
    end if;

--1.1.5 生产范围信息表
    if V_SCFW > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_SCFW', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_SCFW where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_SCFW where qbid = V_qbid;
              insert into XZXK_YLQXSCXKESL_XX_SCFW
               (bzj,  QBID,   sqid, gllb, cpldh, cplmc, cplxh, yjcplb, ejcplb, pmjl, cpms, yqyt, instnum, lastdate, datexc, cplx, lybz)
              select
          sys_guid(), V_qbid ,sqid, gllb, cpldh, cplmc, cplxh, yjcplb, ejcplb, pmjl, cpms, yqyt,  f_getslbs(),sysdate,'11', cplx, lybz
                from GG_XKZ_YLQXSCXKESL_SCFW
                where sqid = V_sqid_h ;
        select 1 into V_BS from dual ;
    else
        update  XZXK_YLQXSCXKESL_XX_SCFW set  sqid  = V_sqid_h  where QBID = V_qbid ;
   end if;

--1.1.6 生产产品信息
   if V_SCCP1 > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_SCCP', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_SCCP where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_SCCP where qbid = V_qbid;
            insert into XZXK_YLQXSCXKESL_XX_SCCP
             (bzj,  QBID,   sqid, sxh, sfstsc, zczh, gllb, cpldh, cplmc, cplxh, yjcplb, ejcplb, cpmc, lb, bz, instnum, lastdate, datexc, cplx, dzrq)
            select
        sys_guid(), V_qbid, sqid, sxh, sfstsc, zczh, gllb, cpldh, cplmc, cplxh, yjcplb, ejcplb, cpmc, lb, bz, f_getslbs(),sysdate,'11', cplx, dzrq
              from GG_XKZ_YLQXSCXKESL_SCCP
              where  sqid = V_sqid_h ;

select 1 into V_BS from dual ;
    else
        update  XZXK_YLQXSCXKESL_XX_SCCP set  sqid  = V_sqid_h  where QBID = V_qbid ;
   end if;

if V_SCCP2 > 0 then
    INSERT INTO PUB_TABLE_DATA_DELEXC(ID, TABLENAME, TABLEPKNAME, TABLEPK, DELFLAG, INSTNUM, LASTDATE, DATEXC)
          select sys_guid(), 'XZXK_YLQXSCXKESL_XX_SCCP', 'BZJ', BZJ as TABLEPK, 'N', f_getslbs(), sysdate, '11' from XZXK_YLQXSCXKESL_XX_SCCP where qbid = V_qbid;

delete XZXK_YLQXSCXKESL_XX_SCCP where qbid = V_qbid;
            insert into XZXK_YLQXSCXKESL_XX_SCCP
             (bzj,  QBID,   sqid, sxh, sfstsc, zczh, gllb, cpldh, cplmc, cplxh, yjcplb, ejcplb, cpmc, lb, bz, instnum, lastdate, datexc, cplx, dzrq)
            select
        sys_guid(), V_qbid, sqid, sxh, sfstsc, zczh, gllb, cpldh, cplmc, cplxh, yjcplb, ejcplb, cpmc, lb, bz, f_getslbs(),sysdate,'11', cplx, dzrq
              from GG_XKZ_YLQXSCXKESL_SCCP
              where  sqid = V_sqid_h ;
    else
        update  XZXK_YLQXSCXKESL_XX_SCCP set  sqid  = V_sqid_h  where QBID = V_qbid ;
   end if;

--long flow
   if (V_QYSCDZ1 > 0 or V_SCCP2 > 0) then
      select 0 into V_BS from dual ;
   else
   --short flow
      select 1 into V_BS from dual ;
   end if;
   --
-- 短变更
   if V_BS > 0  then
       update GG_XKZ_YLQXSCXKESL set  FZRQ = fzrqIn  where sqid=V_sqid_h;
       update  xzxk_ylqxscxkesl_xx_qb set ( xkzbh,    qymc, scfw,   ZSDZ,   czzt,   fzjgmc, scfzrq, FZRQ,  dzrq , DYBS ) =
                                ( select  xkzbh_idIn, qymc, scfw,   ZS,      'V',   FZJGMC, SCFZRQ, fzrqIn,DZRQ , DYBS from GG_XKZ_YLQXSCXKESL where sqid = V_sqid_h and czzt = 'V') where QBID = V_qbid ;
   else
-- 长变更
       update GG_XKZ_YLQXSCXKESL set FZRQ = fzrqIn, YXQZ = yxqzIn  where sqid=V_sqid_h;
       update  xzxk_ylqxscxkesl_xx_qb set ( xkzbh,    qymc, scfw,   ZSDZ,   czzt,   fzjgmc, scfzrq, FZRQ,   YXQZ,     dzrq , DYBS ) =
                                ( select  xkzbh_idIn, qymc, scfw,   ZS,      'V',   FZJGMC, SCFZRQ, fzrqIn ,yxqzIn,   DZRQ , DYBS from GG_XKZ_YLQXSCXKESL where sqid = V_sqid_h and czzt = 'V') where QBID = V_qbid ;
   end if ;

----------------插入------医疗器械生产许可信息全表------------------结束-------------

--------------------------更新信息全表中  个别字段-----------------开始--------------

update  xzxk_ylqxscxkesl_xx_qb set ( LXRXM , LXDH, ZZJGDM, datexc )   =
         ( select  LXRXM , LXDH , ZZJGDM, '11' from XZXK_YLQXSCXKESL_BG_SQ where sqid = bgid_idIn )  where QBID = V_qbid ;

update XZXK_YLQXSCXKESL_xx_RYXX set  XM  =
       ( select XM from GG_XKZ_YLQXSCXKESL_RYXX where   sqid = V_sqid_h  and  RYLX = '0' and rownum = 1 )  where QBID = V_qbid  and RYLX = '0' ;

update XZXK_YLQXSCXKESL_xx_RYXX set  XM  =
       ( select XM from GG_XKZ_YLQXSCXKESL_RYXX where   sqid = V_sqid_h  and  RYLX = '1' and rownum = 1 )  where QBID = V_qbid  and RYLX = '1' ;

--  更新企业类型
 update   xzxk_ylqxscxkesl_xx_qb set qylx =
       ( select qylx from XZXK_YLQXSCXKESL_BG_SQ  where sqid = bgid_idIn ) where QBID = V_qbid ;

-- 修改许可证编号添加‘食’字
   select  length(xkzbh) into V_length  from gg_xkz_ylqxscxkesl t where xkzbh =  xkzbh_idIn  and czzt = 'V';
  -- 修改旧数据
     IF  V_length < 17  THEN
              SELECT REPLACE(xkzbh,(substr( xkzbh, 0, 2 )), '京食药') into V_name2 from xzxk_ylqxscxkesl_xx_qb t where xkzbh = xkzbh_idIn  ;
              update    xzxk_ylqxscxkesl_xx_qb set xkzbh = V_name2  where QBID = V_qbid ;
              update   gg_xkz_ylqxscxkesl  set   xkzbh = V_name2  where  sqid = V_sqid_h  and czzt = 'V' ;
              update   XZXK_YLQXSCXKESL_BG_SQ  set  xkzbh = V_name2  where sqid = bgid_idIn ;
     END IF ;
 --------------------------更新信息全表中  个别字段-----------------开始--------------
    flag := 'Y';
  commit;
Exception
  WHEN v_raise THEN
    flag := 'N';
    rollback;
  WHEN NO_DATA_FOUND THEN
    flag := 'E';
    rollback;
end YLQXSCXKESL_GGXKZ_TO_QB;

存储过程系列五:完整的存储过程备份使用函数REPLACE()substr()的更多相关文章

  1. sql server 备份与恢复系列五 完整模式下的备份与还原

    一.概述 前面介绍了简单恢复模式和大容量恢复模式,这篇继续写完整恢复模式下的备份与还原.在完整恢复模式里最大的优点是只要能成功备份尾日志,就可以还原到日志备份内包含的任何时点("时点恢复&q ...

  2. SQL Server 2008空间数据应用系列十:使用存储过程生成GeoRSS聚合空间信息

    原文:SQL Server 2008空间数据应用系列十:使用存储过程生成GeoRSS聚合空间信息 友情提示,您阅读本篇博文的先决条件如下: 1.本文示例基于Microsoft SQL Server 2 ...

  3. Code First系列之视图,存储过程和异步API

    返回<8天掌握EF的Code First开发>总目录 本篇目录 视图View 存储过程 使用存储过程CRUD 异步API 本章小结 自我测试 本系列的源码本人已托管于coding上:点击查 ...

  4. 解剖SQLSERVER 第十五篇 SQLSERVER存储过程的源文本存放在哪里?(译)

    解剖SQLSERVER 第十五篇  SQLSERVER存储过程的源文本存放在哪里?(译) http://improve.dk/where-does-sql-server-store-the-sourc ...

  5. MySql 存储过程实例(附完整注释)(转)

    MySql 存储过程实例(附完整注释) 将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例:                                   ...

  6. SQL Server中使用msdb数据库的存储过程sp_delete_backuphistory和sp_delete_database_backuphistory来删除备份和恢复历史数据

    根据微软文档对sp_delete_backuphistory存储过程的介绍,SQL Server在每次备份和恢复数据库后,会向msdb系统数据库的备份和恢复历史表写入数据,如果SQL Server经常 ...

  7. 存储过程系列之调试存储过程 SQL Server 2005

    在数据库中直接调试  在数据库中直接调试是调试SQL Server 2005的存储过程的最简单的方法. 在Visual Stuido的IDE中你可以选择单步执行存储过程,然后就可以一条语句一条语句地单 ...

  8. 存储过程系列之存储过程具体操作过程及sql数据库调用

    Transact-SQL中的存储过程,非常类似于Java语言中的方法,它可以重复调用.当存储过程执行一次后,可以将语句缓存中,这样下次执行的时候直接使用缓存中的语句.这样就可以提高存储过程的性能. 存 ...

  9. 存储过程系列之存储过程sql数据库调用和程序代码调用

    1.存储过程,无参数的存储过程 创建无参数存储存储过程 Create Procedure DCEMREMR_TEMPLATEAs SELECT TOP 10 [FILENAME],[FILETITLE ...

随机推荐

  1. MySQL中limit与max同时使用时查询为空的情况

    一般情况下使用limit进行分页时通常是第一页就用max和min这些函数去求值,这样的情况是正常的,但是如果limit去到了第二页的时候发现这样用是不行的,原因未知! 修改的方式如下,适合大部分: , ...

  2. JavaScript的Object的一些静态方法(*************************************************************)

    0. 开场白 这是每天学点javascript系列文章的第一篇,我觉得把这些相关的笔记整理成系列文章会很不错,方便读者阅读的同时也方便自己回顾.最近javascript已经成为了我生活的一部分了,虽然 ...

  3. andriod 获得应用程序名称

    import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; im ...

  4. android listview 添加数据

    <span style="white-space:pre"> </span>listView = (ListView) findViewById(R.id. ...

  5. Python3.2官方文档翻译--作用域和命名空间实例

    6.2.1 作用域和命名空间实例 以下的实例主要用来示范怎样引用不同的作用域和命名空间,keywordglobal和nonlocalru怎样影响变量绑定. 实例执行结果是: After local a ...

  6. [3 Jun 2015 ~ 9 Jun 2015] Deep Learning in arxiv

    arXiv is an e-print service in the fields of physics, mathematics, computer science, quantitative bi ...

  7. js动态函数

    最近项目中使用百度模板引擎baiduTemplate.js,使用动态函数解析模板中代码. 通过new Function([arg1,arg2,...,argN,]functionBody)方式实现动态 ...

  8. Linux基础(1)- 命令和目录文件

    1.开启Linux操作系统,要求以root用户登录GNOME图形界面,语言支持选择为汉语 Linux操作界面如图: 右击桌面,点击打开终端 输入“su”,点击回车键,出现密码,输入密码,点击回车键,显 ...

  9. ubuntu14.04下CPU的caffe配置,不成功的朋友请与我(lee)联系,后面附带邮箱

    因广大朋友需求cpu的caffe配置.所以我(lee)在这份博客中对cpu配置caffe做出对应操作说明.希望能够解决大家对cpu配置caffe的困惑.少走弯路. 假设有安装不成功的朋友能够和我联系, ...

  10. 今日BBC

    1.随身英语 Brain training 怎样训练大脑? link 2.地道英语 In good nick 品质好.没有损坏(主要是指古老的东西,比方古董) link 3.今日新闻 -------- ...