/**Begin D:\nextcloud\dev2main2bizline\PDM_UPGRADE\pdm1\BASE_constraint.sql **/
 EXEC P_ALTERPK 'PK_IM_INV_PER_BAL', 'T_IM_INV_PER_BAL', 'FID', '1';


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_PBAL_OGR') CREATE INDEX IDX_IM_INV_PBAL_OGR ON T_IM_INV_PER_BAL ( FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_PBAL_MT') CREATE INDEX IDX_IM_INV_PBAL_MT ON T_IM_INV_PER_BAL ( FMATERIALID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_PBAL_WS') CREATE INDEX IDX_IM_INV_PBAL_WS ON T_IM_INV_PER_BAL ( FWAREHOUSEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_PBAL_LOT') CREATE INDEX IDX_IM_INV_PBAL_LOT ON T_IM_INV_PER_BAL ( FLOTNUMBER );


 EXEC P_ALTERPK 'PK_IM_INV_PER_BAL_SP', 'T_IM_INV_PER_BAL_SP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_SPBAL_KEY') CREATE INDEX IDX_IM_INV_SPBAL_KEY ON T_IM_INV_PER_BAL_SP ( FKEYCOL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_SPBAL_BID') CREATE INDEX IDX_IM_INV_SPBAL_BID ON T_IM_INV_PER_BAL_SP ( FBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_SPBAL_BNO') CREATE INDEX IDX_IM_INV_SPBAL_BNO ON T_IM_INV_PER_BAL_SP ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_SPBAL_ENID') CREATE INDEX IDX_IM_INV_SPBAL_ENID ON T_IM_INV_PER_BAL_SP ( FENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_INV_SPBAL_UTIME') CREATE INDEX IDX_IM_INV_SPBAL_UTIME ON T_IM_INV_PER_BAL_SP ( FUPDATETIME );


 EXEC P_ALTERPK 'PK_IM_CAL_PER_BAL', 'T_IM_CAL_PER_BAL', 'FID', '1';


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_PBAL_OGR') CREATE INDEX IDX_IM_CAL_PBAL_OGR ON T_IM_CAL_PER_BAL ( FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_PBAL_MT') CREATE INDEX IDX_IM_CAL_PBAL_MT ON T_IM_CAL_PER_BAL ( FMATERIALID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_PBAL_WS') CREATE INDEX IDX_IM_CAL_PBAL_WS ON T_IM_CAL_PER_BAL ( FWAREHOUSEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_PBAL_LOT') CREATE INDEX IDX_IM_CAL_PBAL_LOT ON T_IM_CAL_PER_BAL ( FLOTNUMBER );


 EXEC P_ALTERPK 'PK_IM_CAL_PER_BAL_SP', 'T_IM_CAL_PER_BAL_SP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_SPBAL_KEY') CREATE INDEX IDX_IM_CAL_SPBAL_KEY ON T_IM_CAL_PER_BAL_SP ( FKEYCOL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_SPBAL_BID') CREATE INDEX IDX_IM_CAL_SPBAL_BID ON T_IM_CAL_PER_BAL_SP ( FBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_SPBAL_BNO') CREATE INDEX IDX_IM_CAL_SPBAL_BNO ON T_IM_CAL_PER_BAL_SP ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_SPBAL_ENID') CREATE INDEX IDX_IM_CAL_SPBAL_ENID ON T_IM_CAL_PER_BAL_SP ( FENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_CAL_SPBAL_UTIME') CREATE INDEX IDX_IM_CAL_SPBAL_UTIME ON T_IM_CAL_PER_BAL_SP ( FUPDATETIME );
 
 


/**End D:\nextcloud\dev2main2bizline\PDM_UPGRADE\pdm1\BASE_constraint.sql **/
