Oracle Create Views (view) instances

Source: Internet
Author: User

Grammar:

Create or Replace  as SELECT * from QueryTable[s]

Instance:

Create or Replace ViewVm_wo asSelect '2'  asSources,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  whenWop_ptsize like '%led%tv%'  ThenNVL (Wopd1_capacity_ratio,0)       whenWop_ptsize like '%led%panel%'  ThenNVL (Wopd2_capacity_ratio,0)      Else 0 End) Wo_standard_ratio,round(Decode (NVL (T.wo_rel_hour,0),0,0,( Case  whenWop_ptsize like '%led%tv%'  ThenNVL (Wopd1_capacity_ratio,0)       whenWop_ptsize like '%led%panel%'  ThenNVL (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 fromWo_mstrJoinPt_mstr onPt_part=Wo_partJoinWop1_mstr onPt_size=wop_ptsize Left JoinWopd1_det onWopd1_nbr=Wop_nbr andPt_cmt=Wopd1_capacity_type Left JoinWopd2_det onWopd2_nbr=Wop_nbr andPt_group=Wopd2_capacity_type Left Join (      SelectPzd_wo_nbr,pzd_wo_lot, NVL (sum(Pzd_people_count*Pzd_rel_hour),0) Wo_rel_hour fromPzd_det AJoinPz_mstr b onPz_nbr=PZD_NBRGroup  bypzd_wo_nbr,pzd_wo_lot) T onT.pzd_wo_nbr=Wo_nbr andT.pzd_wo_lot=Wo_lotwhere 1=1   andTrunc (Sysdate,'DD')betweenWop_start andWop_endUnion  All  Select '1'  asSources,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  whenWop_ptsize like '%led%tv%'  ThenNVL (Wopd1_capacity_ratio,0)       whenWop_ptsize like '%led%panel%'  ThenNVL (Wopd2_capacity_ratio,0)      Else 0 End) Wo_standard_ratio,round(Decode (NVL (T.wo_rel_hour,0),0,0,( Case  whenWop_ptsize like '%led%tv%'  ThenNVL (Wopd1_capacity_ratio,0)       whenWop_ptsize like '%led%panel%'  ThenNVL (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(SelectWo_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 fromHuinan.wo_mstr@huinanerp)  JoinHuinan.pt_mstr@huinanerp  onPt_part=Wo_partJoinHuinan.wop1_mstr@huinanerp  onPt_size=wop_ptsize Left JoinHuinan.wopd1_det@huinanerp  onWopd1_nbr=Wop_nbr andPt_cmt=Wopd1_capacity_type Left JoinHuinan.wopd2_det@huinanerp  onWopd2_nbr=Wop_nbr andPt_group=Wopd2_capacity_type Left Join (      SelectPzd_wo_nbr,pzd_wo_lot, NVL (sum(Pzd_people_count*Pzd_rel_hour),0) Wo_rel_hour fromHuinan.pzd_det@huinanerpAJoinHuinan.pz_mstr@huinanerpB onPz_nbr=PZD_NBRGroup  bypzd_wo_nbr,pzd_wo_lot) T onT.pzd_wo_nbr=Wo_nbr andT.pzd_wo_lot=Wo_lotwhere 1=1   andTrunc (Sysdate,'DD')betweenWop_start andWop_end;

Oracle Create Views (view) instances

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.