EXEC P_ALTERPK 'PK_T_PERM_UPGRADEDETAIL', 'T_PERM_UPGRADEDETAIL', 'FID', '1';

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