/**Begin C:\Users\rd_jin_gu\Documents\work\PDM_UPGRADE\PDM1\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_DATASORTENTRY' AND KSQL_COL_NAME ='FCONDITIONS_TAG') 
 ALTER TABLE T_HRCS_DATASORTENTRY ADD (FCONDITIONS_TAG NCLOB DEFAULT ' ' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ANONYMOUSCONFIG') 
 CREATE TABLE T_HRCS_ANONYMOUSCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSIMPLENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FANONYMOUSTYPE CHAR(1) DEFAULT 'A' NOT NULL,
FHANDLECLASS VARCHAR(255) DEFAULT ' ' NOT NULL,
FANONYMOUSRULE VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PRIVACYOBJECT') 
 CREATE TABLE T_HRCS_PRIVACYOBJECT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSIMPLENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FPARAMS BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PRIVACYOBJENTRY') 
 CREATE TABLE T_HRCS_PRIVACYOBJENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FBIZAPPID BIGINT DEFAULT 0 NOT NULL,
FENTITY VARCHAR(50) DEFAULT ' ' NOT NULL,
FTABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
FPRIMARYKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FPRIVACYFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATASUBJECTTYPE VARCHAR(1) DEFAULT 'A' NOT NULL,
FPERSONFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FPERSONFIELDTYPE CHAR(1) DEFAULT 'A' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ANONYMOUSCONFIG_L') 
 CREATE TABLE T_HRCS_ANONYMOUSCONFIG_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PRIVACYOBJECT_L') 
 CREATE TABLE T_HRCS_PRIVACYOBJECT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PRIVACYOBJENTRY_L') 
 CREATE TABLE T_HRCS_PRIVACYOBJENTRY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL
);



/**End C:\Users\rd_jin_gu\Documents\work\PDM_UPGRADE\PDM1\HRCS_table.sql **/
