
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_LOTINTRACK' AND KSQL_COL_NAME ='FMATERIALMASTERID') 
 ALTER TABLE T_IM_LOTINTRACK ADD (FMATERIALMASTERID BIGINT DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_IM_LOTINTRACK' AND KSQL_INDNAME = 'IDX_IM_LOTTRACK_ORG_MS_PD') CREATE INDEX IDX_IM_LOTTRACK_ORG_MS_PD ON T_IM_LOTINTRACK (FORGID, FMATERIALMASTERID, FPRODUCEDATE );
