• ORACLE 和SQLSERVER 两表之间批量更新数据对比


    1、SQLSERVER中的写法:

     --更新上传点表数据
        update ID_MASTER set ONCALL_ID=Tb_Points.ONCALL_ID,
                             ServerName=Tb_Points.ServerName,
                             SISCode = Tb_Points.SISCode,
                             LOC_ID = Tb_Points.JZCode,
                             Unit= Tb_Points.Unit,
                             Description = Tb_Points.PointName
                         from Tb_Points
       where ID_MASTER.ServerName=Tb_Points.ServerName and 
                ID_MASTER.SISCode=Tb_Points.SISCode
        --更新开关量数据
        update BUFFER_DIGI set CTR_VALUE=Tb_Points.RealValue,
                              VALUE_TIME=Tb_Points.InputDate
                          from Tb_Points,ID_MASTER
        where BUFFER_DIGI.ONCALL_ID=ID_MASTER.ONCALL_ID and
                 BUFFER_DIGI.TRANS_ID = ID_MASTER.TRANS_ID and
                 BUFFER_DIGI.LOC_ID = ID_MASTER.LOC_ID and 
                 ID_MASTER.ServerName=Tb_Points.ServerName and
                 ID_MASTER.SISCode=Tb_Points.SISCode 

    2、ORACLE中的写法

    --更新机组信息
    update tb_pointconfig a set (GENERATORID)=
           (select decode(b."GroupId",1,13,2,14) as JZ 
           from sssj b where a.uploadid=b."Id" and a.factoryid=9 and (b."GroupId"=1 or b."GroupId"=2))

    --使用MERGE方法更新数据

    MERGE INTO tb_realtimedatavalue a
           USING tb_pointconfig b
             ON (a.fid = b.factoryid and a.uploadid=b.uploadid)
             WHEN MATCHED THEN
             UPDATE SET a.pointid = b.id
             WHERE a.fid=13

  • 相关阅读:
    freeswitch对媒体的处理的三种方式
    Windows如何在cmd命令行中查看、修改、删除与添加、设置环境变量
    freeswitch电话代接
    freeswitch三方通话配置
    认识拨号计划
    洛谷P4049 [JSOI2007]合金 题解
    2020-9杂题选做
    LOJ#6497. 「雅礼集训 2018 Day1」图 题解
    LOJ#6496. 「雅礼集训 2018 Day1」仙人掌 题解
    LOJ#6495. 「雅礼集训 2018 Day1」树 题解
  • 原文地址:https://www.cnblogs.com/GeneralXU/p/1421175.html
Copyright © 2020-2023  润新知