DB2建表语句

--------------------------------------------------                         
-- Create Table SMY.DEP_AR_SMY_DY                                          
--------------------------------------------------                         
Create table SMY.DEP_AR_SMY_DY (                                           
    ACG_DT                         DATE                NOT NULL    ,       
    DEP_AR_ID                      CHARACTER(32)       NOT NULL    ,       
    CSH_X_RMIT_IND_TP_ID           BIGINT              NOT NULL    ,       
    CCY_ID                         BIGINT              NOT NULL    ,       
    AR_TP_ID                       BIGINT                          ,       
    CST_TP_ID                      BIGINT                          ,       
    DEP_CERC_TP_ID                 BIGINT                          ,       
    DEP_TP_ID                      BIGINT                          ,       
    BIZ_TP_ID                      BIGINT                          ,       
    MGN_TP_ID                      BIGINT                          ,       
    AR_NM                          VARCHAR(128)                    ,       
    DEP_PTY_TP_ID                  BIGINT                          ,       
    BLNG_OU_IP_ID                  CHARACTER(32)                   ,       
    ACG_STC_ITM_ID                 CHARACTER(16)                   ,       
    ODFT_ACG_STC_ITM_ID            CHARACTER(16)                   ,       
    AR_LCS_TP_ID                   BIGINT                          ,       
    FEXCH_CST_TP_ID                BIGINT                          ,       
    PD_GRP_CD                      VARCHAR(2)                      ,       
    PD_CD                          VARCHAR(4)                      ,       
    IS_CRD_AC_F                    SMALLINT                        ,       
    DEP_PRD_NO                     VARCHAR(16)                     ,       
    IS_CR_CERC_F                   SMALLINT                        ,       
    IS_NGTTN_F                     SMALLINT                        ,       
    OPN_BAL                        DECIMAL(26,2)                   ,       
    INT_VAL_DT                     DATE                            ,       
    DEP_PRD_CNT                    VARCHAR(16)                     ,       
    MAT_DT                         DATE                            ,       
    PBC_APRV_NO                    VARCHAR(32)                     ,       
    BAL                            DECIMAL(26,2)                   ,       
    CR_LN_AMT                      DECIMAL(26,2)                   ,       
    FRZ_AMT                        DECIMAL(26,2)                   ,       
    RSV_AMT                        DECIMAL(26,2)                   ,       
    CS_PYMT_AMT                    DECIMAL(26,2)                   ,       
    OPN_DT                         DATE                            ,       
    CLS_DT                         DATE                            ,       
    CST_IP_ID                      CHARACTER(32)                   ,       
    CST_NO                         CHARACTER(32)                   ,       
    CST_NM                         VARCHAR(256)                    ,       
    SETL_DT                        DATE                            ,       
    IDENT_NO                       VARCHAR(32)                     ,       
    IDENT_TP_ID                    BIGINT                          ,       
    OPN_RT                         DECIMAL(16,8)                   ,       
    CERC_NO                        CHARACTER(32)                   ,       
    BRCH_OU_IP_ID                  CHARACTER(32)                   ,       
    FRZ_PYMT_MARK                  VARCHAR(2)                      ,       
    LST_DEP_WD_DT                  DATE                            ,       
    IS_DRMT_AR_F                   BIGINT                          ,       
    LST_TXN_DT                     DATE                            ,       
    ACG_OU_IP_ID                   CHARACTER(32)                   ,       
    FEXCH_AC_TP_ID                 BIGINT                          ,       
    IS_LGL_PN_ODFT_F               SMALLINT                        ,       
    RPT_LOS_TP_ID                  BIGINT                          ,       
    WD_LVL_TP_ID                   BIGINT                          ,       
    FEXCH_AR_TP_ID                 BIGINT                          ,       
    AUTH_AMT                       DECIMAL(26,2)                   ,       
    CRT_EP_ID                      CHARACTER(32)                   ,       
    CERC_STS_TP_ID                 BIGINT                          ,       
    RSVE_AMT                       DECIMAL(26,2)                   ,       
    VIOL_NO                        INTEGER                         ,       
    IS_AUTO_DDCT_F                 SMALLINT                        )       
in USERSPACE1                                                              
Partitioning Key (ACG_DT) Using Hashing                                    
Compress Yes;                                                              
Comment on Table SMY.DEP_AR_SMY_DY is '存款账户汇总表';                    
Comment on Column SMY.DEP_AR_SMY_DY.ACG_DT       is '会计日期';            
Comment on Column SMY.DEP_AR_SMY_DY.DEP_AR_ID    is '存款账号';            
Comment on Column SMY.DEP_AR_SMY_DY.CSH_X_RMIT_IND_TP_ID is '钞汇属性';    
Comment on Column SMY.DEP_AR_SMY_DY.CCY_ID       is '币种';                
Comment on Column SMY.DEP_AR_SMY_DY.AR_TP_ID     is '定期/活期账户标识';   
Comment on Column SMY.DEP_AR_SMY_DY.CST_TP_ID    is '企业、个人标志';      
Comment on Column SMY.DEP_AR_SMY_DY.DEP_CERC_TP_ID is '存单折类型';        
Comment on Column SMY.DEP_AR_SMY_DY.DEP_TP_ID    is '账户类型';            
Comment on Column SMY.DEP_AR_SMY_DY.BIZ_TP_ID    is '业务类别码';          
Comment on Column SMY.DEP_AR_SMY_DY.MGN_TP_ID    is '保证金种类';          
Comment on Column SMY.DEP_AR_SMY_DY.AR_NM        is '账户名称';            
Comment on Column SMY.DEP_AR_SMY_DY.DEP_PTY_TP_ID is '账户性质';           
Comment on Column SMY.DEP_AR_SMY_DY.BLNG_OU_IP_ID is '归属机构';           
Comment on Column SMY.DEP_AR_SMY_DY.ACG_STC_ITM_ID is '科目号';            
Comment on Column SMY.DEP_AR_SMY_DY.ODFT_ACG_STC_ITM_ID is '透支科目号';   
Comment on Column SMY.DEP_AR_SMY_DY.AR_LCS_TP_ID is '账户生命周期';        
Comment on Column SMY.DEP_AR_SMY_DY.FEXCH_CST_TP_ID is '外汇客户类别';     
Comment on Column SMY.DEP_AR_SMY_DY.PD_GRP_CD    is '产品类别码';          
Comment on Column SMY.DEP_AR_SMY_DY.PD_CD        is '产品子代码';          
Comment on Column SMY.DEP_AR_SMY_DY.IS_CRD_AC_F  is '卡关联标志';          
Comment on Column SMY.DEP_AR_SMY_DY.DEP_PRD_NO   is '定期存款存期';        
Comment on Column SMY.DEP_AR_SMY_DY.IS_CR_CERC_F is '质押标志';            
Comment on Column SMY.DEP_AR_SMY_DY.IS_NGTTN_F   is '协定存款标志';        
Comment on Column SMY.DEP_AR_SMY_DY.OPN_BAL      is '开户金额';            
Comment on Column SMY.DEP_AR_SMY_DY.INT_VAL_DT   is '起息日期';            
Comment on Column SMY.DEP_AR_SMY_DY.DEP_PRD_CNT  is '提前通知存款通知天数';
Comment on Column SMY.DEP_AR_SMY_DY.MAT_DT       is '到期日期';            
Comment on Column SMY.DEP_AR_SMY_DY.PBC_APRV_NO  is '央行开户核准书编号';  
Comment on Column SMY.DEP_AR_SMY_DY.BAL          is '账户余额';            
Comment on Column SMY.DEP_AR_SMY_DY.CR_LN_AMT    is '透支额度';            
Comment on Column SMY.DEP_AR_SMY_DY.FRZ_AMT      is '冻结金额';            
Comment on Column SMY.DEP_AR_SMY_DY.RSV_AMT      is '账户当前保留金额';    
Comment on Column SMY.DEP_AR_SMY_DY.CS_PYMT_AMT  is '止付金额';            
Comment on Column SMY.DEP_AR_SMY_DY.OPN_DT       is '开户日期';            
Comment on Column SMY.DEP_AR_SMY_DY.CLS_DT       is '销户日期';            
Comment on Column SMY.DEP_AR_SMY_DY.CST_IP_ID    is '客户内码';            
Comment on Column SMY.DEP_AR_SMY_DY.CST_NO       is '客户号';              
Comment on Column SMY.DEP_AR_SMY_DY.CST_NM       is '客户名称';            
Comment on Column SMY.DEP_AR_SMY_DY.SETL_DT      is '结清日期';            
Comment on Column SMY.DEP_AR_SMY_DY.IDENT_NO     is '开户证件号';          
Comment on Column SMY.DEP_AR_SMY_DY.IDENT_TP_ID  is '开户证件号类型';      
Comment on Column SMY.DEP_AR_SMY_DY.OPN_RT       is '定期存款开户利率';    
Comment on Column SMY.DEP_AR_SMY_DY.CERC_NO      is '凭证号码';            
Comment on Column SMY.DEP_AR_SMY_DY.FRZ_PYMT_MARK is '冻结标识';           
Comment on Column SMY.DEP_AR_SMY_DY.LST_DEP_WD_DT is '最后存取款日期';     
Comment on Column SMY.DEP_AR_SMY_DY.IS_DRMT_AR_F is '是否不动户';          
Comment on Column SMY.DEP_AR_SMY_DY.LST_TXN_DT   is '最后动户交易日期';    
Comment on Column SMY.DEP_AR_SMY_DY.ACG_OU_IP_ID is '核算主体行';          
Comment on Column SMY.DEP_AR_SMY_DY.FEXCH_AC_TP_ID is '外币账户性质';      
Comment on Column SMY.DEP_AR_SMY_DY.IS_LGL_PN_ODFT_F is '法人透支户标识';  
Comment on Column SMY.DEP_AR_SMY_DY.RPT_LOS_TP_ID is '挂失状态';           
Comment on Column SMY.DEP_AR_SMY_DY.WD_LVL_TP_ID is '通兑级别';            
Comment on Column SMY.DEP_AR_SMY_DY.FEXCH_AR_TP_ID is '外汇账户种类';      
Comment on Column SMY.DEP_AR_SMY_DY.AUTH_AMT     is '授权金额';            
Comment on Column SMY.DEP_AR_SMY_DY.CRT_EP_ID    is '建立用户代码';        
Comment on Column SMY.DEP_AR_SMY_DY.CERC_STS_TP_ID is '凭证状态';          
Comment on Column SMY.DEP_AR_SMY_DY.RSVE_AMT     is '控制金额';            
Comment on Column SMY.DEP_AR_SMY_DY.VIOL_NO      is '部支或违约次数';      
Comment on Column SMY.DEP_AR_SMY_DY.IS_AUTO_DDCT_F is '自动转存标志';      
                                                                           
--------------------------------------------------                         
-- Create Index SMY.IDX_DEP_AR_SMY_01                                      
--------------------------------------------------                         
create  Index SMY.IDX_DEP_AR_SMY_01                                        
    on SMY.DEP_AR_SMY_DY                                                     
    (ACG_DT, AR_LCS_TP_ID, AR_TP_ID)    Allow Reverse Scans;                 
                                                                           
--------------------------------------------------                         
-- Create Primary Key SQL161117093932110                                   
--------------------------------------------------                         
alter table SMY.DEP_AR_SMY_DY                                              
    add constraint SQL161117093932110                                        
    Primary Key (ACG_DT, DEP_AR_ID, CSH_X_RMIT_IND_TP_ID, CCY_ID);           

 

--------------------------------------------------                                     
-- Create Table SMY.DEP_AR_SMY                                                         
--------------------------------------------------                                     
Create table SMY.DEP_AR_SMY (                                                          
    ACG_DT                         DATE                NOT NULL    ,                   
    DEP_AR_ID                      CHARACTER(32)       NOT NULL    ,                   
    CSH_X_RMIT_IND_TP_ID           BIGINT              NOT NULL    ,                   
    CCY_ID                         BIGINT              NOT NULL    ,                   
    AR_TP_ID                       BIGINT                          ,                   
    CST_TP_ID                      BIGINT                          ,                   
    DEP_CERC_TP_ID                 BIGINT                          ,                   
    DEP_TP_ID                      BIGINT                          ,                   
    BIZ_TP_ID                      BIGINT                          ,                   
    MGN_TP_ID                      BIGINT                          ,                   
    AR_NM                          VARCHAR(128)                    ,                   
    DEP_PTY_TP_ID                  BIGINT                          ,                   
    BLNG_OU_IP_ID                  CHARACTER(32)                   ,                   
    ACG_STC_ITM_ID                 CHARACTER(16)                   ,                   
    ODFT_ACG_STC_ITM_ID            CHARACTER(16)                   ,                   
    AR_LCS_TP_ID                   BIGINT                          ,                   
    FEXCH_CST_TP_ID                BIGINT                          ,                   
    PD_GRP_CD                      VARCHAR(2)                      ,                   
    PD_CD                          VARCHAR(4)                      ,                   
    IS_CRD_AC_F                    SMALLINT                        ,                   
    DEP_PRD_NO                     VARCHAR(16)                     ,                   
    IS_CR_CERC_F                   SMALLINT                        ,                   
    IS_NGTTN_F                     SMALLINT                        ,                   
    OPN_BAL                        DECIMAL(26,2)                   ,                   
    INT_VAL_DT                     DATE                            ,                   
    DEP_PRD_CNT                    VARCHAR(16)                     ,                   
    MAT_DT                         DATE                            ,                   
    PBC_APRV_NO                    VARCHAR(32)                     ,                   
    BAL                            DECIMAL(26,2)                   ,                   
    CR_LN_AMT                      DECIMAL(26,2)                   ,                   
    FRZ_AMT                        DECIMAL(26,2)                   ,                   
    RSV_AMT                        DECIMAL(26,2)                   ,                   
    CS_PYMT_AMT                    DECIMAL(26,2)                   ,                   
    OPN_DT                         DATE                            ,                   
    CLS_DT                         DATE                            ,                   
    CST_IP_ID                      CHARACTER(32)                   ,                   
    CST_NO                         CHARACTER(32)                   ,                   
    CST_NM                         VARCHAR(256)                    ,                   
    SETL_DT                        DATE                            ,                   
    IDENT_NO                       VARCHAR(32)                     ,                   
    IDENT_TP_ID                    BIGINT                          ,                   
    OPN_RT                         DECIMAL(16,8)                   ,                   
    CERC_NO                        CHARACTER(32)                   ,                   
    BRCH_OU_IP_ID                  CHARACTER(32)                   ,                   
    FRZ_PYMT_MARK                  VARCHAR(2)                      ,                   
    LST_DEP_WD_DT                  DATE                            ,                   
    IS_DRMT_AR_F                   BIGINT                          ,                   
    LST_TXN_DT                     DATE                            ,                   
    ACG_OU_IP_ID                   CHARACTER(32)                   ,                   
    FEXCH_AC_TP_ID                 BIGINT                          ,                   
    IS_LGL_PN_ODFT_F               SMALLINT                        ,                   
    RPT_LOS_TP_ID                  BIGINT                          ,                   
    WD_LVL_TP_ID                   BIGINT                          ,                   
    FEXCH_AR_TP_ID                 BIGINT                          ,                   
    AUTH_AMT                       DECIMAL(26,2)                   ,                   
    CRT_EP_ID                      CHARACTER(32)                   ,                   
    CERC_STS_TP_ID                 BIGINT                          ,                   
    RSVE_AMT                       DECIMAL(26,2)                   ,                   
    VIOL_NO                        INTEGER                         ,                   
    IS_AUTO_DDCT_F                 SMALLINT                        )  Index in TS_IDX  
Partitioning Key (ACG_DT) Using Hashing                                                
Compress Yes;                                                                          
Comment on Table SMY.DEP_AR_SMY is '存款账户汇总表';                                   
Comment on Column SMY.DEP_AR_SMY.ACG_DT          is '会计日期';                        
Comment on Column SMY.DEP_AR_SMY.DEP_AR_ID       is '存款账号';                        
Comment on Column SMY.DEP_AR_SMY.CSH_X_RMIT_IND_TP_ID is '钞汇属性';                   
Comment on Column SMY.DEP_AR_SMY.CCY_ID          is '币种';                            
Comment on Column SMY.DEP_AR_SMY.AR_TP_ID        is '定期/活期账户标识';               
Comment on Column SMY.DEP_AR_SMY.CST_TP_ID       is '企业、个人标志';                  
Comment on Column SMY.DEP_AR_SMY.DEP_CERC_TP_ID  is '存单折类型';                      
Comment on Column SMY.DEP_AR_SMY.DEP_TP_ID       is '账户类型';                        
Comment on Column SMY.DEP_AR_SMY.BIZ_TP_ID       is '业务类别码';                      
Comment on Column SMY.DEP_AR_SMY.MGN_TP_ID       is '保证金种类';                      
Comment on Column SMY.DEP_AR_SMY.AR_NM           is '账户名称';                        
Comment on Column SMY.DEP_AR_SMY.DEP_PTY_TP_ID   is '账户性质';                        
Comment on Column SMY.DEP_AR_SMY.BLNG_OU_IP_ID   is '归属机构';                        
Comment on Column SMY.DEP_AR_SMY.ACG_STC_ITM_ID  is '科目号';                          
Comment on Column SMY.DEP_AR_SMY.ODFT_ACG_STC_ITM_ID is '透支科目号';                  
Comment on Column SMY.DEP_AR_SMY.AR_LCS_TP_ID    is '账户生命周期';                    
Comment on Column SMY.DEP_AR_SMY.FEXCH_CST_TP_ID is '外汇客户类别';                    
Comment on Column SMY.DEP_AR_SMY.PD_GRP_CD       is '产品类别码';                      
Comment on Column SMY.DEP_AR_SMY.PD_CD           is '产品子代码';                      
Comment on Column SMY.DEP_AR_SMY.IS_CRD_AC_F     is '卡关联标志';                      
Comment on Column SMY.DEP_AR_SMY.DEP_PRD_NO      is '定期存款存期';                    
Comment on Column SMY.DEP_AR_SMY.IS_CR_CERC_F    is '质押标志';                        
Comment on Column SMY.DEP_AR_SMY.IS_NGTTN_F      is '协定存款标志';                    
Comment on Column SMY.DEP_AR_SMY.OPN_BAL         is '开户金额';                        
Comment on Column SMY.DEP_AR_SMY.INT_VAL_DT      is '起息日期';                        
Comment on Column SMY.DEP_AR_SMY.DEP_PRD_CNT     is '提前通知存款通知天数';            
Comment on Column SMY.DEP_AR_SMY.MAT_DT          is '到期日期';                        
Comment on Column SMY.DEP_AR_SMY.PBC_APRV_NO     is '央行开户核准书编号';              
Comment on Column SMY.DEP_AR_SMY.BAL             is '账户余额';                        
Comment on Column SMY.DEP_AR_SMY.CR_LN_AMT       is '透支额度';                        
Comment on Column SMY.DEP_AR_SMY.FRZ_AMT         is '冻结金额';                        
Comment on Column SMY.DEP_AR_SMY.RSV_AMT         is '账户当前保留金额';                
Comment on Column SMY.DEP_AR_SMY.CS_PYMT_AMT     is '止付金额';                        
Comment on Column SMY.DEP_AR_SMY.OPN_DT          is '开户日期';                        
Comment on Column SMY.DEP_AR_SMY.CLS_DT          is '销户日期';                        
Comment on Column SMY.DEP_AR_SMY.CST_IP_ID       is '客户内码';                        
Comment on Column SMY.DEP_AR_SMY.CST_NO          is '客户号';                          
Comment on Column SMY.DEP_AR_SMY.CST_NM          is '客户名称';                        
Comment on Column SMY.DEP_AR_SMY.SETL_DT         is '结清日期';                        
Comment on Column SMY.DEP_AR_SMY.IDENT_NO        is '开户证件号';                      
Comment on Column SMY.DEP_AR_SMY.IDENT_TP_ID     is '开户证件号类型';                  
Comment on Column SMY.DEP_AR_SMY.OPN_RT          is '定期存款开户利率';                
Comment on Column SMY.DEP_AR_SMY.CERC_NO         is '凭证号码';                        
Comment on Column SMY.DEP_AR_SMY.FRZ_PYMT_MARK   is '冻结标识';                        
Comment on Column SMY.DEP_AR_SMY.LST_DEP_WD_DT   is '最后存取款日期';                  
Comment on Column SMY.DEP_AR_SMY.IS_DRMT_AR_F    is '是否不动户';                      
Comment on Column SMY.DEP_AR_SMY.LST_TXN_DT      is '最后动户交易日期';                
Comment on Column SMY.DEP_AR_SMY.ACG_OU_IP_ID    is '核算主体行';                      
Comment on Column SMY.DEP_AR_SMY.FEXCH_AC_TP_ID  is '外币账户性质';                    
Comment on Column SMY.DEP_AR_SMY.IS_LGL_PN_ODFT_F is '法人透支户标识';                 
Comment on Column SMY.DEP_AR_SMY.RPT_LOS_TP_ID   is '挂失状态';                        
Comment on Column SMY.DEP_AR_SMY.WD_LVL_TP_ID    is '通兑级别';                        
Comment on Column SMY.DEP_AR_SMY.FEXCH_AR_TP_ID  is '外汇账户种类';                    
Comment on Column SMY.DEP_AR_SMY.AUTH_AMT        is '授权金额';                        
Comment on Column SMY.DEP_AR_SMY.CRT_EP_ID       is '建立用户代码';                    
Comment on Column SMY.DEP_AR_SMY.CERC_STS_TP_ID  is '凭证状态';                        
Comment on Column SMY.DEP_AR_SMY.RSVE_AMT        is '控制金额';                        
Comment on Column SMY.DEP_AR_SMY.VIOL_NO         is '部支或违约次数';                  
Comment on Column SMY.DEP_AR_SMY.IS_AUTO_DDCT_F  is '自动转存标志';                    
                                                                                       
--------------------------------------------------                                     
-- Create Index SMY.IDX_DEP_AR_SMY_01                                                  
--------------------------------------------------                                     
create  Index SMY.IDX_DEP_AR_SMY_01                                                    
    on SMY.DEP_AR_SMY                                                                    
    (ACG_DT, AR_LCS_TP_ID, AR_TP_ID)    Allow Reverse Scans;                             
                                                                                       
--------------------------------------------------                                     
-- Create Primary Key SQL161117093932110                                               
--------------------------------------------------                                     
alter table SMY.DEP_AR_SMY                                                             
    add constraint SQL161117093932110                                                    
    Primary Key (ACG_DT, DEP_AR_ID, CSH_X_RMIT_IND_TP_ID, CCY_ID);                       

 

posted @ 2017-03-24 11:04  Blue眼泪2016  阅读(18677)  评论(0编辑  收藏  举报