/**Begin D:\workspace\_workspace_\_workspace_doc_\工具\PDM_UPGRADE\PDMNEW\FPM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_SUBJECTCANCELCONFIG' AND KSQL_COL_NAME IN ('FDIFFPROCESSMODE'))
ALTER TABLE T_FPM_SUBJECTCANCELCONFIG ADD (FDIFFPROCESSMODE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_SUBJECTCANCELCONFIG' AND KSQL_COL_NAME IN ('FACCURATEMATCHMODE'))
ALTER TABLE T_FPM_SUBJECTCANCELCONFIG ADD (FACCURATEMATCHMODE CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_SUBJECTCANCELCONFIG' AND KSQL_COL_NAME IN ('FOFFSETSCHEME'))
ALTER TABLE T_FPM_SUBJECTCANCELCONFIG ADD (FOFFSETSCHEME VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_SUBJECTCANCELCONFIG' AND KSQL_COL_NAME IN ('FOFFSETSCHEMESAVE'))
ALTER TABLE T_FPM_SUBJECTCANCELCONFIG ADD (FOFFSETSCHEMESAVE NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_CUSDIM')
CREATE TABLE T_FPM_CUSDIM (
                              FPKID BIGINT DEFAULT 0 NOT NULL,
                              FID BIGINT DEFAULT 0 NOT NULL,
                              FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_CUSDIM1')
CREATE TABLE T_FPM_CUSDIM1 (
                               FPKID BIGINT DEFAULT 0 NOT NULL,
                               FID BIGINT DEFAULT 0 NOT NULL,
                               FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_CUSDIM2')
CREATE TABLE T_FPM_CUSDIM2 (
                               FPKID BIGINT DEFAULT 0 NOT NULL,
                               FID BIGINT DEFAULT 0 NOT NULL,
                               FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_INNERCANCELDETAIL' AND KSQL_COL_NAME IN ('FOFFSETBATCHNUMBER'))
ALTER TABLE T_FPM_INNERCANCELDETAIL ADD (FOFFSETBATCHNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_INNERCANCELDETAIL' AND KSQL_COL_NAME IN ('FOURSIDEORG'))
ALTER TABLE T_FPM_INNERCANCELDETAIL ADD (FOURSIDEORG BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_INNERCANCELDETAIL' AND KSQL_COL_NAME IN ('FCORRESPONDENCEORG'))
ALTER TABLE T_FPM_INNERCANCELDETAIL ADD (FCORRESPONDENCEORG BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_INNERCANCELDETAIL' AND KSQL_COL_NAME IN ('FENTRYOTHERDIMID1'))
ALTER TABLE T_FPM_INNERCANCELDETAIL ADD (FENTRYOTHERDIMID1 BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_INNERCANCELDETAIL' AND KSQL_COL_NAME IN ('FENTRYOTHERDIMID2'))
ALTER TABLE T_FPM_INNERCANCELDETAIL ADD (FENTRYOTHERDIMID2 BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_INNERCANCELTOTAL')
CREATE TABLE T_FPM_INNERCANCELTOTAL (
                                        FID BIGINT DEFAULT 0 NOT NULL,
                                        FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                        FSEQ INT DEFAULT 0 NOT NULL,
                                        FOFFSETBATCHNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
                                        FOFFSETDETAILNUM INT DEFAULT 0 NOT NULL,
                                        FOFFSETAMTSUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                        FDIFFDIRECTION VARCHAR(50) DEFAULT ' ' NOT NULL,
                                        FDIFFAMTSUM DECIMAL(23,10) DEFAULT 0 NOT NULL
);



/**End D:\workspace\_workspace_\_workspace_doc_\工具\PDM_UPGRADE\PDMNEW\FPM_table.sql **/
