• NC客商bd_custbank不可修改账号、名称但可修改默认银行并更新分子公司trigger


    create or replace trigger S_UPDATE_CUSTBANK
      before  update on  bd_custbank
      for each row
    declare
      -- local variables here
       pk_bas char(20);
    
      cursor basjob(id char) is
        select pk_custbank
          from ncv5.bd_custbank /*目标数据库表*/
         where pk_custbank = id
           and nvl(dr, 0) = 0;
    begin
       /*判断数据是否在目标数据库存在*/
      open basjob(:new.pk_custbank);
    
      loop
    
        fetch basjob
          into pk_bas;
    
        exit when basjob%notfound;
    
      end loop;
      close basjob;
      /******************************/
    
      if pk_bas is not null then
       if 
        :new.account<>:old.account or
        :new.accname<>:old.accname or
        :new.memo<>:old.memo then
      raise_application_error(-20001, '请点击客商开户银行修改,此处不可修改!');
      else
         begin
          update ncv5.bd_custbank /*目标数据库表*/
             set pk_custbank = :new.pk_custbank,
                 pk_cubasdoc = :new.pk_cubasdoc,
                 accname     = :new.accname,
                 account     = :new.account,
                 accaddr     = :new.accaddr,
                 defflag     = :new.defflag,
                 memo        = :new.memo,
                 pk_accbank  = :new.pk_accbank,
                 pk_corp     = :new.pk_corp,
                 pk_currtype = :new.pk_currtype,
                 ts          = :new.ts,
                 dr          = :new.dr
           where pk_custbank = :new.pk_custbank;
        end;
    
      end if;
        end if;
    end S_UPDATE_CUSTBANK;

  • 相关阅读:
    Linux目录操作
    图形库
    Mybatis两表连接(一对一)
    ssm图片上传到数据库
    ajax函数实例
    html、css基础
    HDU 1213 How Many Tables
    HTML5简介
    在script中创建标签的三种方式
    html css js jq问题总结
  • 原文地址:https://www.cnblogs.com/sumsen/p/2582353.html
Copyright © 2020-2023  润新知