/**智能体推荐方案**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_RECOMMENDPLAN')
CREATE TABLE T_ER_RECOMMENDPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FSCHEMETYPE VARCHAR(50) DEFAULT 'tempRecommended' NOT NULL,
FSESSIONID VARCHAR(100) DEFAULT ' ' NOT NULL
);
EXEC p_AlterPK 'PK_ER_RECOMMENDPLAN', 'T_ER_RECOMMENDPLAN', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_RECOMMENDPLAN' AND KSQL_COL_NAME ='FBILLID')
 ALTER TABLE T_ER_RECOMMENDPLAN ADD (FBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_RECOMMENDPLAN' AND KSQL_COL_NAME ='FTRIPINFO')
 ALTER TABLE T_ER_RECOMMENDPLAN ADD (FTRIPINFO VARCHAR(2000) DEFAULT ' ' NOT NULL );

EXEC p_AlterColumn 'T_ER_RECOMMENDPLAN', 'FSCHEMETYPE', 'VARCHAR(50)', 'NOT NULL', '0001', '''tripCard''';

/**智能体推荐方案分录表**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_RECOMPLANDETAIL')
CREATE TABLE T_ER_RECOMPLANDETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAGENTNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FAGENTVALUE VARCHAR(255) DEFAULT ' ' NOT NULL,
FAGENTVALUE_TAG NCLOB,
FENTRYSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FISBOOK  CHAR(1) DEFAULT '0' NOT NULL
);
EXEC p_AlterPK 'PK_ER_RECOMPLANDETAIL', 'T_ER_RECOMPLANDETAIL', 'FENTRYID', '1';





