zoukankan      html  css  js  c++  java
  • Oracle:物化视图创建及刷新的脚本.

    SET DEFINE OFF;

    DROP MATERIALIZED VIEW TMS.TMS_LOCATION;

    CREATE MATERIALIZED VIEW TMS.TMS_LOCATION

    TABLESPACE TMSDATA

    NOCACHE

    LOGGING

    NOCOMPRESS

    NOPARALLEL

    BUILD IMMEDIATE

    REFRESH FORCE ON DEMAND

    WITH PRIMARY KEY

    AS

    select tl.*,decode(tl.location_type,'VENDOR',null,wpbu.business_unit_4) branch4,decode(tl.location_type,'VENDOR',null,wpbu.business_unit) branch5, decode(tvx.new_vendor_no,null,null,wl.location_id) vendor_location,tvx.new_vendor_no,tvx.old_vendor

    from wms.wms_intf_location_tms_vw tl, wms.wms_location wl, tms_ven_xref tvx ,wms_ps_business_unit wpbu

    where

    tl.location_id=wpbu.campus_id(+) and

    tl.location_id=wl.location_id and

    SUBSTR ('000000' || tvx.new_vendor_no(+),

                                                 -10

                                                )

                                      || SUBSTR ('0000000000' || tvx.new_location(+),

                                                 -10

                                                ) = wl.location_name;

    COMMENT ON MATERIALIZED VIEW TMS.TMS_LOCATION IS 'snapshot table for snapshot

    TMS.TMS_LOCATION';

    CREATE UNIQUE INDEX TMS.TMS_LOCATION_PK ON TMS.TMS_LOCATION

    (LOCATION_ID)

    LOGGING

    TABLESPACE TMSDATA

    NOPARALLEL;

    GRANT SELECT ON  TMS.TMS_LOCATION TO TMS_GUEST;


    dbms_mview.REFRESH ('TMS_LOCATION');

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    Keepalived 无法自动转换主备角色,请关注 iptables 防火墙配置
    Linux 下使用网易的SMTP服务器 发送邮件
    Spring-boot 最小demo
    go build 时报错 cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
    spark-shell 执行脚本并传入参数
    JVM
    spark
    spark
    linux
    linux
  • 原文地址:https://www.cnblogs.com/tracy/p/1712743.html
Copyright © 2011-2022 走看看