IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_MEALAPPLICATION_BILL_L')
CREATE TABLE T_ER_MEALAPPLICATION_BILL_L (
                                             FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
                                             FID BIGINT DEFAULT 0 NOT NULL,
                                             FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
                                             FAPPLIERPOSITION VARCHAR(50) DEFAULT ' ' NOT NULL
);

EXEC P_ALTERPK 'PK_T_ER_MEALAPPLICATION_BILL_L', 'T_ER_MEALAPPLICATION_BILL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_MEALAPPLICATION_BILL_L') CREATE INDEX IDX_ER_MEALAPPLICATION_BILL_L ON T_ER_MEALAPPLICATION_BILL_L ( FID ,FLOCALEID );