oracle sql应用总结

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.分组统计及表使用索引进行查询、表连接查询


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值