oracle sql应用总结

来源:互联网 发布:石家庄淘宝拍照 编辑:程序博客网 时间:2024/06/01 14:15

1.case应用和||应用实例

select o.oidleft || o.oidrite || o.oidtype as ONUID,
       d.nmsuserlabel as 设备名称,
       c.name as 设备编码,
       '' as 接入类型,
       '' as 所属机房ID,
       o.location3 as 所属机房,
       o.networkid as 所属EMS,
       d.nmschnlabel as 安装具体地址描述,
       '' as 归属分光器,
       c.nodeid as oltip,
       c.ontid as ontid,
       c.oltoidleft || c.oltoidrite || c.oltoidtype as 归属OLT,
       c.oltptpoidleft || c.oltptpoidrite || c.oltptpoidtype as 归属OLT的PON口主用,
       '' as 归属OLT的PON口备用,
       '' as 产权,
       case
         when a.vendor = 100 then
          'Cisco'
         when a.vendor = 104 then
          'Alcatel-Lucent'
         when a.vendor = 115 then
          '华为'
         when a.vendor = 116 then
          '中兴'
         when a.vendor = 125 then
          '烽火'
         when a.vendor = 126 then
          'H3C'
         when a.vendor = 127 then
          '锐捷'
       end as 厂家名称,
       c.onttype as 规格型号,
       case
         when o.installationstatus = 1 then
          '入网'
         when o.installationstatus = 2 then
          '未入网'
      
         when o.installationstatus = 3 then
          '拆除'
         when o.installationstatus = 4 then
          '关机'
       end as 网元状态,
       c.ontsoftwareversion as 版本信息,
       '' as 入网时间,
       '' as 退网时间,
     '' as 覆盖范围,
       c.ipaddr as 设备管理地址,
       c.macaddr as 设备注册MAC地址,
       '' as 域名标识,
       '' as 语音的IP地址,
       c.olttimeslot as ONU的ID号
  from nmsnetworkelement o, nodetypemap a, ont c, nmsnetworkelement d
 where o.nodetype = a.typeid
   and o.nodeid = c.nodeid
   and o.networkid = c.networkid
   and c.ontid = d.nodeid
   and c.networkid = d.networkid

2.update级联更新

 update oltvoipservice x set x.phnum = (select y.phone from resources_oltvoipservice y where x.ip = y.ip and x.tid = y.tid)
where exists (select 1 from resources_oltvoipservice y where x.ip = y.ip and x.tid = y.tid)

3.分组统计及表使用索引进行查询、表连接查询


0 0
原创粉丝点击