Oracle 建立視圖(View)執行個體

來源:互聯網
上載者:User

標籤:person   art   lin   div   span   and   code   nbsp   oracle   

文法:

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

 

執行個體:

create or replace view vm_wo asselect ‘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;

 

Oracle 建立視圖(View)執行個體

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.