日期在物化视图中显示空白?

时间:2013-10-02 02:14:19

标签: oracle11g materialized-views

我有一个我这样创建的物化视图:

    DROP MATERIALIZED VIEW DMSN.SFMV_DS3R_FH_1XRTT_BTS_LVL;
    CREATE MATERIALIZED VIEW DMSN.SFMV_DS3R_FH_1XRTT_BTS_LVL (D_DTM_DAY,MRKT_NM,BSC_NM,CLUSTER_NM,CSCD_NM,BTS_ID,REGION_NM,V_ATT_CNT,V_MBL_ORG_CNT,V_MBL_TER_CNT,V_SILENT_RETRY_CNT,V_CUST_BLK_CNT,V_AXS_F_CNT,V_CE_BLK_CNT,V_WCD_BLK_CNT,V_T1_BHL_BLK_CNT,V_PWR_BLK_CNT,V_NON_BTS_EQ_BLK_CNT,V_SFUL_CALL_CNT,V_DRP_CALL_CNT,D_ATT_CNT,D_MBL_ORG_CNT,D_MBL_TER_CNT,D_SILENT_RETRY_CNT,D_CUST_BLK_CNT,D_AXS_F_CNT,D_CE_BLK_CNT,D_WCD_BLK_CNT,D_T1_BHL_BLK_CNT,D_PWR_BLK_CNT,D_NON_BTS_EQ_BLK_CNT,D_SFUL_CALL_CNT,D_DRP_CALL_CNT,V_PRIM_CALL_ERL,V_MOU_TMS,D_PRIM_CALL_ERL,SMS_ATT_CNT,SMS_SXS_CNT,V_HHI_ATT_CNT,V_HHI_BAD_FRM_CNT,V_HHI_CALL_SETUP_SXS_CNT,D_HHI_ATT_CNT,D_HHI_BAD_FRM_CNT,D_HHI_CALL_SETUP_SXS_CNT,PGN_CH_MSG_SZ,AVLBL_PGN_CH_CNT,AVLBL_AXS_CH_CNT,AXS_CH_MSG_SZ,V_IVHHO_ATT_CNT,V_IVHHO_SXS_CNT,D_IVHHO_ATT_CNT,D_IVHHO_SXS_CNT,IBHO_ATT_CNT,IBHO_SXS_CNT,IFHHO_ATT_CNT,IFHHO_SXS_CNT,SHO_ATT_CNT,SHO_SXS_CNT,SRHO_ATT_CNT,SRHO_SXS_CNT,MAX_LOD_SPD,GPM_SDB_DAB_CAL,IBHO_DOWN_ATT_CNT,IBHO_UP_ATT_CNT,IBHO_UP_SUC_CNT,IBHO_DOWN_SUC_CNT,PGN_CH_MAX,PGN_CH_AVG,AXS_CH_AVG,AXS_CH_MAX,PGN_CH_OPCY_NEW,PGN_CH_OPCY_NEW_MAX)
    TABLESPACE DMD_SN_01
    PCTUSED    0
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                NEXT             1M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
                FLASH_CACHE      DEFAULT
                CELL_FLASH_CACHE DEFAULT
               )
    NOCACHE
    LOGGING
    BUILD IMMEDIATE
    REFRESH FORCE ON DEMAND
    WITH PRIMARY KEY
    AS 
    /* Formatted on 10/1/2013 9:06:16 PM (QP5 v5.215.12089.38647) */
      SELECT DDTMDAY AS D_DTM_DAY,
             MRKTNM AS MRKT_NM,
             BSMNM AS BSC_NM,
             CLNM AS CLUSTER_NM,
             CSCDNM AS CSCD_NM,
             BTSID AS BTS_ID,
             REGIONNM AS REGION_NM,
             SUM (VATTCNT) AS V_ATT_CNT,
             SUM (VMBLORGCNT) AS V_MBL_ORG_CNT,
             SUM (VMBLTERCNT) AS V_MBL_TER_CNT,
             SUM (VSILENTRETRYCNT) AS V_SILENT_RETRY_CNT,
             SUM (VCUSTBLKCNT) AS V_CUST_BLK_CNT,
             SUM (VAXSFCNT) AS V_AXS_F_CNT,
             SUM (VCEBLKCNT) AS V_CE_BLK_CNT,
             SUM (VWCDBLKCNT) AS V_WCD_BLK_CNT,
             SUM (VT1BHLBLKCNT) AS V_T1_BHL_BLK_CNT,
             SUM (VPWRBLKCNT) AS V_PWR_BLK_CNT,
             SUM (VNONBTSEQBLKCNT) AS V_NON_BTS_EQ_BLK_CNT,
             SUM (VSFULCALLCNT) AS V_SFUL_CALL_CNT,
             SUM (VDRPCALLCNT) AS V_DRP_CALL_CNT,
             SUM (DATTCNT) AS D_ATT_CNT,
             SUM (DMBLORGCNT) AS D_MBL_ORG_CNT,
             SUM (DMBLTERCNT) AS D_MBL_TER_CNT,
             SUM (DSILENTRETRYCNT) AS D_SILENT_RETRY_CNT,
             SUM (DCUSTBLKCNT) AS D_CUST_BLK_CNT,
             SUM (DAXSFCNT) AS D_AXS_F_CNT,
             SUM (DCEBLKCNT) AS D_CE_BLK_CNT,
             SUM (DWCDBLKCNT) AS D_WCD_BLK_CNT,
             SUM (DT1BHLBLKCNT) AS D_T1_BHL_BLK_CNT,
             SUM (DPWRBLKCNT) AS D_PWR_BLK_CNT,
             SUM (DNONBTSEQBLKCNT) AS D_NON_BTS_EQ_BLK_CNT,
             SUM (DSFULCALLCNT) AS D_SFUL_CALL_CNT,
             SUM (DDRPCALLCNT) AS D_DRP_CALL_CNT,
             SUM (VPRIMCALLERL) AS V_PRIM_CALL_ERL,
             SUM (VMOUTMS) AS V_MOU_TMS,
             SUM (DPRIMCALLERL) AS D_PRIM_CALL_ERL,
             SUM (SMSATTCNT) AS SMS_ATT_CNT,
             SUM (SMSSXSCNT) AS SMS_SXS_CNT,
             SUM (VHHIATTCNT) AS V_HHI_ATT_CNT,
             SUM (VHHIBADFRMCNT) AS V_HHI_BAD_FRM_CNT,
             SUM (VHHICALLSETUPSXSCNT) AS V_HHI_CALL_SETUP_SXS_CNT,
             SUM (DHHIATTCNT) AS D_HHI_ATT_CNT,
             SUM (DHHIBADFRMCNT) AS D_HHI_BAD_FRM_CNT,
             SUM (DHHICALLSETUPSXSCNT) AS D_HHI_CALL_SETUP_SXS_CNT,
             SUM (PGNCHMSGSZ) AS PGN_CH_MSG_SZ,
             SUM (AXSCHMSGSZ) AS AVLBL_PGN_CH_CNT,
             SUM (VIVHHOATTCNT) AS AVLBL_AXS_CH_CNT,
             SUM (VIVHHOSXSCNT) AS AXS_CH_MSG_SZ,
             SUM (DIVHHOATTCNT) AS V_IVHHO_ATT_CNT,
             SUM (DIVHHOSXSCNT) AS V_IVHHO_SXS_CNT,
             SUM (IBHOATTCNT) AS D_IVHHO_ATT_CNT,
             SUM (IBHOSXSCNT) AS D_IVHHO_SXS_CNT,
             SUM (IFHHOATTCNT) AS IBHO_ATT_CNT,
             SUM (IFHHOSXSCNT) AS IBHO_SXS_CNT,
             SUM (SHOATTCNT) AS IFHHO_ATT_CNT,
             SUM (SHOSXSCNT) AS IFHHO_SXS_CNT,
             SUM (SRHOATTCNT) AS SHO_ATT_CNT,
             SUM (SRHOSXSCNT) AS SHO_SXS_CNT,
             MAX (AVLBLPGNCHCNT) AS SRHO_ATT_CNT,
             MAX (AVLBLAXSCHCNT) AS SRHO_SXS_CNT,
             SUM (MAXLODSPD) AS MAX_LOD_SPD,
             SUM (GPMSDBDABCAL) AS GPM_SDB_DAB_CAL,
             SUM (IBHODOWNATTCNT) AS IBHO_DOWN_ATT_CNT,
             SUM (IBHOUPATTCNT) AS IBHO_UP_ATT_CNT,
             SUM (IBHOUPSUCCNT) AS IBHO_UP_SUC_CNT,
             SUM (IBHODOWNSUCCNT) AS IBHO_DOWN_SUC_CNT,
             MAX (PGNCHMAX) AS PGN_CH_MAX,
             AVG (PGNCHAVG) AS PGN_CH_AVG,
             AVG (AXSCHAVG) AS AXS_CH_AVG,
             MAX (AXSCHMAX) AS AXS_CH_MAX,
             AVG (PGNCHOPCYNEW) AS PGN_CH_OPCY_NEW,
             MAX (PGNCHOPCYNEWMAX) AS PGN_CH_OPCY_NEW_MAX
        FROM (SELECT TRUNC (D1."D_DTM", 'fmdd') AS "DDTMDAY",
                     D2."MRKT_NM" AS "MRKTNM",
                     D3."BSC_NM" AS "BSMNM",
                     D3."BSC_NM" AS "BSCNM",
                     D2."CLUSTER_NM" AS "CLNM",
                     D1."CSCD_NM" AS "CSCDNM",
                     D1."BTS_ID" AS "BTSID",
                     D1."V_ATT_CNT" AS "VATTCNT",
                     D1."V_MBL_ORG_CNT" AS "VMBLORGCNT",
                     D1."V_MBL_TER_CNT" AS "VMBLTERCNT",
                     D1."V_SILENT_RETRY_CNT" AS "VSILENTRETRYCNT",
                     D1."V_CUST_BLK_CNT" AS "VCUSTBLKCNT",
                     D1."V_AXS_F_CNT" AS "VAXSFCNT",
                     D1."V_CE_BLK_CNT" AS "VCEBLKCNT",
                     D1."V_WCD_BLK_CNT" AS "VWCDBLKCNT",
                     D1."V_T1_BHL_BLK_CNT" AS "VT1BHLBLKCNT",
                     D1."V_PWR_BLK_CNT" AS "VPWRBLKCNT",
                     D1."V_NON_BTS_EQ_BLK_CNT" AS "VNONBTSEQBLKCNT",
                     D1."V_SFUL_CALL_CNT" AS "VSFULCALLCNT",
                     D1."V_DRP_CALL_CNT" AS "VDRPCALLCNT",
                     D1."D_ATT_CNT" AS "DATTCNT",
                     D1."D_MBL_ORG_CNT" AS "DMBLORGCNT",
                     D1."D_MBL_TER_CNT" AS "DMBLTERCNT",
                     D1."D_SILENT_RETRY_CNT" AS "DSILENTRETRYCNT",
                     D1."D_CUST_BLK_CNT" AS "DCUSTBLKCNT",
                     D1."D_AXS_F_CNT" AS "DAXSFCNT",
                     D1."D_CE_BLK_CNT" AS "DCEBLKCNT",
                     D1."D_WCD_BLK_CNT" AS "DWCDBLKCNT",
                     D1."D_T1_BHL_BLK_CNT" AS "DT1BHLBLKCNT",
                     D1."D_PWR_BLK_CNT" AS "DPWRBLKCNT",
                     D1."D_NON_BTS_EQ_BLK_CNT" AS "DNONBTSEQBLKCNT",
                     D1."D_SFUL_CALL_CNT" AS "DSFULCALLCNT",
                     D1."D_DRP_CALL_CNT" AS "DDRPCALLCNT",
                     D1."V_PRIM_CALL_ERL" AS "VPRIMCALLERL",
                     D1."V_MOU_TMS" AS "VMOUTMS",
                     D1."D_PRIM_CALL_ERL" AS "DPRIMCALLERL",
                     D1."SMS_ATT_CNT" AS "SMSATTCNT",
                     D1."SMS_SXS_CNT" AS "SMSSXSCNT",
                     D1."V_HHI_ATT_CNT" AS "VHHIATTCNT",
                     D1."V_HHI_BAD_FRM_CNT" AS "VHHIBADFRMCNT",
                     D1."V_HHI_CALL_SETUP_SXS_CNT" AS "VHHICALLSETUPSXSCNT",
                     D1."D_HHI_ATT_CNT" AS "DHHIATTCNT",
                     D1."D_HHI_BAD_FRM_CNT" AS "DHHIBADFRMCNT",
                     D1."D_HHI_CALL_SETUP_SXS_CNT" AS "DHHICALLSETUPSXSCNT",
                     D1."PGN_CH_MSG_SZ" AS "PGNCHMSGSZ",
                     D1."AVLBL_PGN_CH_CNT" AS "AVLBLPGNCHCNT",
                     D1."AVLBL_AXS_CH_CNT" AS "AVLBLAXSCHCNT",
                     D1."AXS_CH_MSG_SZ" AS "AXSCHMSGSZ",
                     D1."V_IVHHO_ATT_CNT" AS "VIVHHOATTCNT",
                     D1."V_IVHHO_SXS_CNT" AS "VIVHHOSXSCNT",
                     D1."D_IVHHO_ATT_CNT" AS "DIVHHOATTCNT",
                     D1."D_IVHHO_SXS_CNT" AS "DIVHHOSXSCNT",
                     D1."IBHO_ATT_CNT" AS "IBHOATTCNT",
                     D1."IBHO_SXS_CNT" AS "IBHOSXSCNT",
                     D1."IFHHO_ATT_CNT" AS "IFHHOATTCNT",
                     D1."IFHHO_SXS_CNT" AS "IFHHOSXSCNT",
                     D1."SHO_ATT_CNT" AS "SHOATTCNT",
                     D1."SHO_SXS_CNT" AS "SHOSXSCNT",
                     D1."SRHO_ATT_CNT" AS "SRHOATTCNT",
                     D1."SRHO_SXS_CNT" AS "SRHOSXSCNT",
                     D1."MAX_LOD_SPD" AS "MAXLODSPD",
                     D1."GPM_SDB_DAB_CAL" AS "GPMSDBDABCAL",
                     D1."IBHO_DOWN_ATT_CNT" AS "IBHODOWNATTCNT",
                     D1."IBHO_UP_ATT_CNT" AS "IBHOUPATTCNT",
                     D1."IBHO_UP_SUC_CNT" AS "IBHOUPSUCCNT",
                     D1."IBHO_DOWN_SUC_CNT" AS "IBHODOWNSUCCNT",
                     D1."PGN_CH_MAX" AS "PGNCHMAX",
                     D1."PGN_CH_AVG" AS "PGNCHAVG",
                     D1."AXS_CH_AVG" AS "AXSCHAVG",
                     D1."AXS_CH_MAX" AS "AXSCHMAX",
                     D1."PGN_CH_OPCY_NEW" AS "PGNCHOPCYNEW",
                     D1."PGN_CH_OPCY_NEW_MAX" AS "PGNCHOPCYNEWMAX",
                     D2."MRKT_NM" AS "MRKTNM2",
                     D2."REGION_NM" AS "REGIONNM"
                FROM "DMSN"."DS3R_FH_1XRTT_BTS_LVL_KPI" D1
                     LEFT OUTER JOIN "DMSN"."SITES_GEO_HIERARCHY" D2
                        ON     D1."BTS_ID" = D2."BTS_ID"
                           AND D1."CSCD_NM" = D2."CSCD_NM"
                     LEFT OUTER JOIN "DMSN"."SITES_SYS_HIERARCHY" D3
                        ON     D1."BTS_ID" = D3."BTS_ID"
                           AND D1."CSCD_NM" = D3."CSCD_NM"
               WHERE D1."D_DTM" >= TRUNC (SYSDATE, 'dd') - 91) T
    GROUP BY DDTMDAY,
             MRKTNM,
             BSMNM,
             CLNM,
             CSCDNM,
             BTSID,
             REGIONNM;


    COMMENT ON MATERIALIZED VIEW DMSN.SFMV_DS3R_FH_1XRTT_BTS_LVL IS 'snapshot table for snapshot DMSN.SFMV_DS3R_FH_1XRTT_BTS_LVL';

    CREATE INDEX DMSN.IDX1_SFMV_FH_1XRTT_BTS_LVL ON DMSN.SFMV_DS3R_FH_1XRTT_BTS_LVL
    (D_DTM_DAY, CSCD_NM, BTS_ID)
    LOGGING
    TABLESPACE DMD_SN_01
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                NEXT             1M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
                FLASH_CACHE      DEFAULT
                CELL_FLASH_CACHE DEFAULT
               );

但是当我在蟾蜍上做一个简单的select *时,日期显示空白。在toad中,当我双击列中的任何日期字段时,我得到一个值。我不确定这里发生了什么,但由于某种原因,应用程序甚至无法查询日期列。

当我在select *中运行sqlplus时,它也会显示空白....

SQL> SELECT ROWNUM, T1.D_DTM_DAY FROM SFMV_DS3R_FH_1XRTT_BTS_LVL T1 WHERE ROWNUM < 6;


ROWNUM D_DTM_DAY
     1
     2
     3
     4
     5

关于为什么会发生这种情况的任何想法?

1 个答案:

答案 0 :(得分:0)

此代码:

TRUNC(D1."D_DTM", 'fmdd')

......可能是:

TRUNC(D1."D_DTM")

......或:

to_number(to_char(D1."D_DTM", 'fmdd'))