/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_constraint.sql **/
 EXEC P_ALTERPK 'PK_FAH_BIZ_CLASS', 'T_FAH_BIZ_CLASS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BIZ_CLASS' AND KSQL_INDNAME = 'IDX_FAH_BIZ_CLASS_NO') CREATE UNIQUE INDEX IDX_FAH_BIZ_CLASS_NO ON T_FAH_BIZ_CLASS ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_BIZ_CLASS_L', 'T_FAH_BIZ_CLASS_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BIZ_CLASS_L' AND KSQL_INDNAME = 'IDX_FAH_BIZ_CLASS_L') CREATE INDEX IDX_FAH_BIZ_CLASS_L ON T_FAH_BIZ_CLASS_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_BIZ_TYPE', 'T_FAH_BIZ_TYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BIZ_TYPE' AND KSQL_INDNAME = 'IDX_FAH_BIZ_TYPE_NO') CREATE UNIQUE INDEX IDX_FAH_BIZ_TYPE_NO ON T_FAH_BIZ_TYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_BIZ_TYPE_L', 'T_FAH_BIZ_TYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BIZ_TYPE_L' AND KSQL_INDNAME = 'IDX_FAH_BIZ_TYPE_L') CREATE INDEX IDX_FAH_BIZ_TYPE_L ON T_FAH_BIZ_TYPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_GEN_RULE', 'T_FAH_EVT_GEN_RULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_GEN_RULE' AND KSQL_INDNAME = 'IDX_FAH_EVT_GEN_RULE_NO') CREATE UNIQUE INDEX IDX_FAH_EVT_GEN_RULE_NO ON T_FAH_EVT_GEN_RULE ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_EVT_GEN_RULE_L', 'T_FAH_EVT_GEN_RULE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_GEN_RULE_L' AND KSQL_INDNAME = 'IDX_FAH_EVT_GEN_RULE_L') CREATE INDEX IDX_FAH_EVT_GEN_RULE_L ON T_FAH_EVT_GEN_RULE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_LINETYPE', 'T_FAH_EVT_LINETYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_LINETYPE' AND KSQL_INDNAME = 'IDX_FAH_EVT_LINETYPE_NO') CREATE UNIQUE INDEX IDX_FAH_EVT_LINETYPE_NO ON T_FAH_EVT_LINETYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_EVT_LINETYPE_L', 'T_FAH_EVT_LINETYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_LINETYPE_L' AND KSQL_INDNAME = 'IDX_FAH_EVT_LINETYPE_L') CREATE INDEX IDX_FAH_EVT_LINETYPE_L ON T_FAH_EVT_LINETYPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_EVTLINE_GEN_RULE', 'T_FAH_EVTLINE_GEN_RULE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVTLINE_GEN_RULE' AND KSQL_INDNAME = 'IDX_FAH_EVTLINE_GEN_RULE') CREATE INDEX IDX_FAH_EVTLINE_GEN_RULE ON T_FAH_EVTLINE_GEN_RULE ( FID );


 EXEC P_ALTERPK 'PK_FAH_DYN_EXTFLD', 'T_FAH_DYN_EXTFLD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DYN_EXTFLD' AND KSQL_INDNAME = 'IDX_FAH_DYN_EXTFLD_NO') CREATE INDEX IDX_FAH_DYN_EXTFLD_NO ON T_FAH_DYN_EXTFLD ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_DYN_EXTFLD_CUSTRULE', 'T_FAH_DYN_EXTFLD_CUSTRULE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DYN_EXTFLD_CUSTRULE' AND KSQL_INDNAME = 'IDX_FAH_DYN_EXTFLD_CUSTRULE') CREATE INDEX IDX_FAH_DYN_EXTFLD_CUSTRULE ON T_FAH_DYN_EXTFLD_CUSTRULE ( FID );


 EXEC P_ALTERPK 'PK_FAH_DYN_EXTFLD_ENTRY', 'T_FAH_DYN_EXTFLD_ENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DYN_EXTFLD_ENTRY' AND KSQL_INDNAME = 'IDX_FAH_DYN_EXTFLD_ENTRY') CREATE INDEX IDX_FAH_DYN_EXTFLD_ENTRY ON T_FAH_DYN_EXTFLD_ENTRY ( FID );


 EXEC P_ALTERPK 'PK_FAH_DYN_EXTFLD_L', 'T_FAH_DYN_EXTFLD_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DYN_EXTFLD_L' AND KSQL_INDNAME = 'IDX_FAH_DYN_EXTFLD_L') CREATE INDEX IDX_FAH_DYN_EXTFLD_L ON T_FAH_DYN_EXTFLD_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_DYNEXTFLD_MAPEN', 'T_FAH_DYNEXTFLD_MAPEN', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DYNEXTFLD_MAPEN' AND KSQL_INDNAME = 'IDX_FAH_DYNEXTFLD_MAPEN') CREATE INDEX IDX_FAH_DYNEXTFLD_MAPEN ON T_FAH_DYNEXTFLD_MAPEN ( FID );


 EXEC P_ALTERPK 'PK_FAH_DYNEXTFLD_VALSET', 'T_FAH_DYNEXTFLD_VALSET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DYNEXTFLD_VALSET' AND KSQL_INDNAME = 'IDX_FAH_DYNEXTFLD_VALSET') CREATE INDEX IDX_FAH_DYNEXTFLD_VALSET ON T_FAH_DYNEXTFLD_VALSET ( FBRANCHID );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCOUNTBOOKCFG', 'T_FAH_EVT_ACCOUNTBOOKCFG', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCOUNTBOOKCFG' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCOUNTBOOKCFG') CREATE INDEX IDX_FAH_EVT_ACCOUNTBOOKCFG ON T_FAH_EVT_ACCOUNTBOOKCFG ( FID );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCOUNTPURPOSE', 'T_FAH_EVT_ACCOUNTPURPOSE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCOUNTPURPOSE' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCOUNTPURPOSE_NO') CREATE INDEX IDX_FAH_EVT_ACCOUNTPURPOSE_NO ON T_FAH_EVT_ACCOUNTPURPOSE ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCOUNTPURPOSE_L', 'T_FAH_EVT_ACCOUNTPURPOSE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCOUNTPURPOSE_L' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCOUNTPURPOSE_L') CREATE INDEX IDX_FAH_EVT_ACCOUNTPURPOSE_L ON T_FAH_EVT_ACCOUNTPURPOSE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCTGROUP', 'T_FAH_EVT_ACCTGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCTGROUP' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCTGROUP') CREATE INDEX IDX_FAH_EVT_ACCTGROUP ON T_FAH_EVT_ACCTGROUP ( FACCTRULEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCTLINE', 'T_FAH_EVT_ACCTLINE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCTLINE' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCTLINE') CREATE INDEX IDX_FAH_EVT_ACCTLINE ON T_FAH_EVT_ACCTLINE ( FACCTRULEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCTPUBLICINFO', 'T_FAH_EVT_ACCTPUBLICINFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCTPUBLICINFO' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCTPUBLICINFO') CREATE INDEX IDX_FAH_EVT_ACCTPUBLICINFO ON T_FAH_EVT_ACCTPUBLICINFO ( FACCTRULEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCTRULE', 'T_FAH_EVT_ACCTRULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCTRULE' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCTRULE_NO') CREATE INDEX IDX_FAH_EVT_ACCTRULE_NO ON T_FAH_EVT_ACCTRULE ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_EVT_ACCTRULE_L', 'T_FAH_EVT_ACCTRULE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_ACCTRULE_L' AND KSQL_INDNAME = 'IDX_FAH_EVT_ACCTRULE_L') CREATE INDEX IDX_FAH_EVT_ACCTRULE_L ON T_FAH_EVT_ACCTRULE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_EN', 'T_FAH_EVT_DISP_EN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_EN' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_EN') CREATE INDEX IDX_FAH_EVT_DISP_EN ON T_FAH_EVT_DISP_EN ( FDISPATCHID );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_PARAMCFG', 'T_FAH_EVT_DISP_PARAMCFG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_PARAMCFG' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_PARAMCFG') CREATE INDEX IDX_FAH_EVT_DISP_PARAMCFG ON T_FAH_EVT_DISP_PARAMCFG ( FDISPATCHID );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_RULE', 'T_FAH_EVT_DISP_RULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_RULE' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_RULE') CREATE INDEX IDX_FAH_EVT_DISP_RULE ON T_FAH_EVT_DISP_RULE ( FDISPATCHID );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_RULE_TMP', 'T_FAH_EVT_DISP_RULE_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_RULE_TMP' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_RULE_TMP') CREATE INDEX IDX_FAH_EVT_DISP_RULE_TMP ON T_FAH_EVT_DISP_RULE_TMP ( FDISPATCHID );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_SCHEME', 'T_FAH_EVT_DISP_SCHEME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_SCHEME' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_SCHEME') CREATE UNIQUE INDEX IDX_FAH_EVT_DISP_SCHEME ON T_FAH_EVT_DISP_SCHEME ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_SCHEME_L', 'T_FAH_EVT_DISP_SCHEME_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_SCHEME_L' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_SCHEME_L') CREATE INDEX IDX_FAH_EVT_DISP_SCHEME_L ON T_FAH_EVT_DISP_SCHEME_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_EVT_DISP_SUBEN', 'T_FAH_EVT_DISP_SUBEN', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_DISP_SUBEN' AND KSQL_INDNAME = 'IDX_FAH_EVT_DISP_SUBEN') CREATE INDEX IDX_FAH_EVT_DISP_SUBEN ON T_FAH_EVT_DISP_SUBEN ( FID );


 EXEC P_ALTERPK 'PK_FAH_EVTLINE_DIMGRP_CFG', 'T_FAH_EVTLINE_DIMGRP_CFG', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVTLINE_DIMGRP_CFG' AND KSQL_INDNAME = 'IDX_FAH_EVTLINE_DIMGRP_CFG') CREATE INDEX IDX_FAH_EVTLINE_DIMGRP_CFG ON T_FAH_EVTLINE_DIMGRP_CFG ( FENTRYID );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_TYPE_L', 'T_FAH_DIMGRP_TYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE_L' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_L') CREATE INDEX IDX_FAH_DIMGRP_TYPE_L ON T_FAH_DIMGRP_TYPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_TYPE_EVTLNK', 'T_FAH_DIMGRP_TYPE_EVTLNK', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE_EVTLNK' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_EVTLNK1') CREATE INDEX IDX_FAH_DIMGRP_TYPE_EVTLNK1 ON T_FAH_DIMGRP_TYPE_EVTLNK ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE_EVTLNK' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_EVTLNK2') CREATE INDEX IDX_FAH_DIMGRP_TYPE_EVTLNK2 ON T_FAH_DIMGRP_TYPE_EVTLNK ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_TYPE_EN', 'T_FAH_DIMGRP_TYPE_EN', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE_EN' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_EN1') CREATE INDEX IDX_FAH_DIMGRP_TYPE_EN1 ON T_FAH_DIMGRP_TYPE_EN ( FDIMINNERID ,FCUSTGRPID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE_EN' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_EN2') CREATE INDEX IDX_FAH_DIMGRP_TYPE_EN2 ON T_FAH_DIMGRP_TYPE_EN ( FID );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_TYPE_CUST', 'T_FAH_DIMGRP_TYPE_CUST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE_CUST' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_CUST') CREATE INDEX IDX_FAH_DIMGRP_TYPE_CUST ON T_FAH_DIMGRP_TYPE_CUST ( FDIMGRPTYPEID );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_TYPE', 'T_FAH_DIMGRP_TYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_TYPE' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_TYPE_NO') CREATE INDEX IDX_FAH_DIMGRP_TYPE_NO ON T_FAH_DIMGRP_TYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_FAH_REGBILL', 'T_FAH_REGBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_REGBILL' AND KSQL_INDNAME = 'IDX_FAH_REGBILL') CREATE INDEX IDX_FAH_REGBILL ON T_FAH_REGBILL ( FSRCBILLTYPE ,FENABLE );


 EXEC P_ALTERPK 'PK_FAH_EVTLINE_RELATION', 'T_FAH_EVTLINE_RELATION', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVTLINE_RELATION' AND KSQL_INDNAME = 'IDX_FAH_EVTLINE_RELATION') CREATE INDEX IDX_FAH_EVTLINE_RELATION ON T_FAH_EVTLINE_RELATION ( FENTRYID );



/**End D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_constraint.sql **/
