• Oracle 创建视图(View)实例


    语法:

    create or replace 【ViewName】 as
    select * from QueryTable[s]

    实例:

    create or replace view vm_wo as
    select '2' as sources,wo_nbr,wo_lot,wo_cust,wo_part,wo_rel_date,wo_due_date,wo_qty_ord,wo_status,wo_line,wo_so_nbr,wo_so_line,
    wo_soft,wo_soft_ver,wo_rmks,wo_mod_date,
    (case when wop_ptsize like '%LED%TV%' then nvl(wopd1_capacity_ratio,0)
          when wop_ptsize like '%LED%PANEL%' then nvl(wopd2_capacity_ratio,0)
          else 0 end) wo_standard_ratio,
    round(decode(nvl(t.wo_rel_hour,0),0,0,(case when wop_ptsize like '%LED%TV%' then nvl(wopd1_capacity_ratio,0)
          when wop_ptsize like '%LED%PANEL%' then nvl(wopd2_capacity_ratio,0)
          else 0 end) * wo_qty_comp / t.wo_rel_hour),4) wo_standard_efficient,
    nvl(wo_std_pl,0) wo_standard_person,
    round(nvl(wo_man_haur,0),4) wo_standard_time
      from wo_mstr
      join pt_mstr on pt_part = wo_part
      join wop1_mstr on pt_size = wop_ptsize
      left join wopd1_det on wopd1_nbr = wop_nbr and pt_cmt = wopd1_capacity_type
      left join wopd2_det on wopd2_nbr = wop_nbr and pt_group = wopd2_capacity_type
      left join (
          select pzd_wo_nbr,pzd_wo_lot, nvl(sum(pzd_people_count*pzd_rel_hour),0) wo_rel_hour
          from pzd_det a  join pz_mstr b on pz_nbr = pzd_nbr
          group by pzd_wo_nbr,pzd_wo_lot
      ) t on t.pzd_wo_nbr = wo_nbr and t.pzd_wo_lot = wo_lot
      where 1=1
      and trunc(sysdate,'dd') between wop_start and wop_end
      union all
      select '1' as sources,wo_nbr,wo_lot,wo_cust,wo_part,wo_rel_date,wo_due_date,wo_qty_ord,wo_status,wo_line,wo_so_nbr,wo_so_line,
    wo_soft,wo_soft_ver,wo_rmks,wo_mod_date,
    (case when wop_ptsize like '%LED%TV%' then nvl(wopd1_capacity_ratio,0)
          when wop_ptsize like '%LED%PANEL%' then nvl(wopd2_capacity_ratio,0)
          else 0 end) wo_standard_ratio,
    round(decode(nvl(t.wo_rel_hour,0),0,0,(case when wop_ptsize like '%LED%TV%' then nvl(wopd1_capacity_ratio,0)
          when wop_ptsize like '%LED%PANEL%' then nvl(wopd2_capacity_ratio,0)
          else 0 end) * wo_qty_comp / t.wo_rel_hour),4) wo_standard_efficient,
    nvl(wo_std_pl,0) wo_standard_person,
    round(nvl(wo_man_haur,0),4) wo_standard_time
      from (select wo_nbr,wo_lot,wo_cust,wo_part,wo_rel_date,wo_due_date,wo_qty_ord,wo_status,wo_line,wo_so_nbr,wo_so_line,
    wo_soft,wo_soft_ver,wo_rmks,wo_mod_date,wo_std_pl,wo_man_haur,wo_qty_comp from huinan.wo_mstr@huinanerp)
      join huinan.pt_mstr@huinanerp on pt_part = wo_part
      join huinan.wop1_mstr@huinanerp on pt_size = wop_ptsize
      left join huinan.wopd1_det@huinanerp on wopd1_nbr = wop_nbr and pt_cmt = wopd1_capacity_type
      left join huinan.wopd2_det@huinanerp on wopd2_nbr = wop_nbr and pt_group = wopd2_capacity_type
      left join (
          select pzd_wo_nbr,pzd_wo_lot, nvl(sum(pzd_people_count*pzd_rel_hour),0) wo_rel_hour
          from huinan.pzd_det@huinanerp a  join huinan.pz_mstr@huinanerp b on pz_nbr = pzd_nbr
          group by pzd_wo_nbr,pzd_wo_lot
      ) t on t.pzd_wo_nbr = wo_nbr and t.pzd_wo_lot = wo_lot
      where 1=1
      and trunc(sysdate,'dd') between wop_start and wop_end;
  • 相关阅读:
    统计学习方法学习笔记第二章(感知机)
    filebeat句柄占用问题
    小组年终总结的汇总
    使用docker制作zookeeper镜像
    普罗米修斯在k8s上面的部署
    k8s亲和性和反亲和性的理解
    AlertManager 的在k8s集群上面的安装部署使用
    filebeat生产上面镜像制作的流程
    普罗米修斯生产上面的性能优化点
    AlertManger集群的搭建
  • 原文地址:https://www.cnblogs.com/su1643/p/8004552.html
Copyright © 2020-2023  润新知