EXEC P_ALTERPK 'PK_MSPLAN_PRIORITY', 'T_MSPLAN_PRIORITY', 'FID', '1';

EXEC P_ALTERPK 'PK_MSPLAN_PDEFINE', 'T_MSPLAN_PDEFINE', 'FID', '1';

EXEC P_ALTERPK 'PK_MSPLAN_PRIORITY_L', 'T_MSPLAN_PRIORITY_L', 'FPKID', '1'; 

EXEC P_ALTERPK 'PK_MSPLAN_PDEFINE_L', 'T_MSPLAN_PDEFINE_L', 'FPKID', '1'; 

EXEC P_ALTERPK 'PK_MSPLAN_PRIORITYENTRY', 'T_MSPLAN_PRIORITYENTRY', 'FENTRYID', '1';

EXEC P_ALTERPK 'PK_MSPLAN_PDEFINEENTRY', 'T_MSPLAN_PDEFINEENTRY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PRIORITY_NUMBER') CREATE INDEX IDX_MSPLAN_PRIORITY_NUMBER ON T_MSPLAN_PRIORITY ( FNUMBER );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PDEFINE_NUMBER') CREATE INDEX IDX_MSPLAN_PDEFINE_NUMBER ON T_MSPLAN_PDEFINE ( FNUMBER );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PRIORITYENTRY') CREATE INDEX IDX_MSPLAN_PRIORITYENTRY ON T_MSPLAN_PRIORITYENTRY ( FID ,FSEQ );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PDEFINEENTRY') CREATE INDEX IDX_MSPLAN_PDEFINEENTRY ON T_MSPLAN_PDEFINEENTRY ( FID ,FSEQ );

