/**Begin D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_EXCEPTIONRECORD') 
 CREATE TABLE T_HDM_EXCEPTIONRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FTRANSFERBILLID BIGINT DEFAULT 0 NOT NULL,
FINTEGRATEPOINT VARCHAR(2) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FINTEGRATEWAY VARCHAR(2) DEFAULT ' ' NOT NULL,
RETRYNUM INT DEFAULT 0 NOT NULL,
FPARAMS VARCHAR(255) DEFAULT ' ' NOT NULL,
FPARAMS_TAG NCLOB DEFAULT ' ',
FRTPARAMS VARCHAR(255) DEFAULT ' ' NOT NULL,
FRTPARAMS_TAG NCLOB DEFAULT ' ',
FERRORLOG VARCHAR(255) DEFAULT ' ' NOT NULL,
FERRORLOG_TAG NCLOB DEFAULT ' '
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBILL_D')
 CREATE TABLE T_HDM_TRANSFERBILL_D (
FID BIGINT DEFAULT 0 NOT NULL,
FBJOBGRADESCMID BIGINT DEFAULT 0 NOT NULL,
FAEVALUATIONJOBID BIGINT DEFAULT 0 NOT NULL,
FBJOBLEVELSCMID BIGINT DEFAULT 0 NOT NULL,
FBJOBLEVELID BIGINT DEFAULT 0 NOT NULL,
FBJOBGRADEID BIGINT DEFAULT 0 NOT NULL,
FAJOBLEVELSCMID BIGINT DEFAULT 0 NOT NULL,
FAJOBORGID BIGINT DEFAULT 0 NOT NULL,
FBJOBORGID BIGINT DEFAULT 0 NOT NULL,
FAJOBGRADEID BIGINT DEFAULT 0 NOT NULL,
FBEVALUATIONJOBID BIGINT DEFAULT 0 NOT NULL,
FAJOBLEVELID BIGINT DEFAULT 0 NOT NULL,
FAJOBGRADESCMID BIGINT DEFAULT 0 NOT NULL,
FAJOBSCMID BIGINT DEFAULT 0 NOT NULL,
FAJOBFAMILYID BIGINT DEFAULT 0 NOT NULL,
FAJOBCLASSID BIGINT DEFAULT 0 NOT NULL,
FAJOBSEQID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HDM_TRANSFERBILL' AND KSQL_COL_NAME ='FBPOSTPATTERN')
 ALTER TABLE T_HDM_TRANSFERBILL ADD (FBPOSTPATTERN VARCHAR(2) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HDM_TRANSFERBILL_B' AND KSQL_COL_NAME ='FAREALITYJOBID')
 ALTER TABLE T_HDM_TRANSFERBILL_B ADD (FAREALITYJOBID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HDM_TRANSFERBILL_B' AND KSQL_COL_NAME ='FAPLANJOBID')
 ALTER TABLE T_HDM_TRANSFERBILL_B ADD (FAPLANJOBID BIGINT DEFAULT 0 NOT NULL );


/**End D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
