CREATE TABLE HRMSUBCOMPANY_VERSION (
	ID NUMBER NOT NULL,
	SUBCOMID NUMBER NULL,
	SUBCOMPANYDESC NVARCHAR2 ( 255 ) NULL,
	SUBCOMPANYCODE NVARCHAR2 ( 255 ) NULL,
	SUBCOMPANYNAME NVARCHAR2 ( 255 ) NULL,
	SUPSUBCOMID NUMBER NULL,
	SHOWORDER NUMBER NULL,
	CANCELED NUMBER NULL,
	DESCRIPTION NVARCHAR2 ( 2000 ) NULL,
	OPERATOR NVARCHAR2 ( 255 ) NULL,
	VERSION NUMBER ( 9,1 ) NULL,
	OPERATE_TIME DATE NULL,
	CONSTRAINT HRMSUBCOMPANY_VERSION_PK PRIMARY KEY ( ID ) 
) 
/ 

CREATE SEQUENCE HRMSUBCOMPANY_VERSION_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE 
/ 

CREATE 
OR REPLACE TRIGGER HRMCOMP_VERSION_ID_TIGGER BEFORE INSERT ON HRMSUBCOMPANY_VERSION FOR EACH ROW
BEGIN
	SELECT
		HRMSUBCOMPANY_VERSION_ID.nextval INTO :new.ID 
	FROM
		dual;
	
END;
/ 

CREATE TABLE HRMDEPARTMENT_VERSION (
	ID NUMBER NOT NULL,
	DEPARTMENTID NUMBER NULL,
	DEPARTMENTMARK NVARCHAR2 ( 255 ) NULL,
	DEPARTMENTCODE NVARCHAR2 ( 255 ) NULL,
	DEPARTMENTNAME NVARCHAR2 ( 255 ) NULL,
	SUBCOMPANYID1 NUMBER NULL,
	SUPDEPID NUMBER NULL,
	BMFZR NVARCHAR2 ( 2000 ) NULL,
	SHOWORDER NUMBER NULL,
	CANCELED NUMBER NULL,
	DESCRIPTION NVARCHAR2 ( 2000 ) NULL,
	OPERATOR NVARCHAR2 ( 255 ) NULL,
	VERSION NUMBER ( 9,1 ) NULL,
	OPERATE_TIME DATE NULL,
	CONSTRAINT HRMDEPARTMENT_VERSION_PK PRIMARY KEY ( ID ) 
) 
/ 

CREATE SEQUENCE HRMDEPARTMENT_VERSION_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE 
/ 

CREATE
OR REPLACE TRIGGER HRMDEPT_VERSION_ID_TIGGER BEFORE INSERT ON HRMDEPARTMENT_VERSION FOR EACH ROW
BEGIN
SELECT
    HRMDEPARTMENT_VERSION_ID.nextval INTO :new.ID
FROM
    dual;
END;
/

CREATE TABLE "HRMRESOURCE_VERSION" (
  "ID" NUMBER NOT NULL,
  "RESOURCEID" NUMBER,
  "COMPANYSTARTDATE" DATE NULL,
	"COMPANYWORKYEAR" NUMBER,
	"WORKSTARTDATE" DATE NULL,
	"WORKYEAR" NUMBER,
	"USEKIND" NUMBER,
	"JOBCALL" NUMBER,
  "ACCUMFUNDACCOUNT" NVARCHAR2 (100) NULL,
	"BIRTHPLACE" NVARCHAR2 (255) NULL,
	"FOLK" NVARCHAR2 (255) NULL,
	"RESIDENTPHONE" NVARCHAR2 (255) NULL,
	"RESIDENTPOSTCODE" NVARCHAR2 (1000) NULL,
	"EXTPHONE" NVARCHAR2 (255) NULL,
	"MANAGERSTR" NVARCHAR2 (255) NULL,
	"STATUS" NUMBER,
	"FAX" NVARCHAR2 (255) NULL,
	"ISLABOUUNION" CHAR(10),
	"WEIGHT" NUMBER,
	"TEMPRESIDENTNUMBER" VARCHAR2(1000),
  "PROBATIONENDDATE" DATE NULL,
  "COUNTRYID" NUMBER DEFAULT 1,
  "PASSWDCHGDATE" DATE NULL,
	"LLOGINID" VARCHAR2(1000),
  "DSPORDER" FLOAT(126),
  "PASSWORDSTATE" NUMBER,
  "ACCOUNTTYPE" NUMBER,
  "BELONGTO" NUMBER,
	"MESSAGERURL" VARCHAR2(1000),
	"ACCOUNTNAME" VARCHAR2(1000),
	"LOGINID" VARCHAR2(1000),
	"PASSWORD" VARCHAR2(1000),
	"LASTNAME" VARCHAR2(1000),
  "SEX" CHAR(1),
  "BIRTHDAY" CHAR(10),
  "NATIONALITY" NUMBER,
  "MARITALSTATUS" CHAR(1),
  "TELEPHONE" VARCHAR2(1000),
  "MOBILE" VARCHAR2(1000),
  "MOBILECALL" VARCHAR2(1000),
  "EMAIL" VARCHAR2(1000),
  "LOCATIONID" NUMBER,
  "WORKROOM" VARCHAR2(1000),
  "HOMEADDRESS" VARCHAR2(1000),
  "RESOURCETYPE" CHAR(1),
  "STARTDATE" DATE NULL,
  "ENDDATE" DATE NULL,
  "JOBTITLE" NUMBER,
  "JOBACTIVITYDESC" VARCHAR2(1000),
  "JOBLEVEL" NUMBER,
  "SECLEVEL" NUMBER,
  "DEPARTMENTID" NUMBER,
  "SUBCOMPANYID1" NUMBER,
  "COSTCENTERID" NUMBER,
  "MANAGERID" NUMBER,
  "ASSISTANTID" NUMBER,
  "BANKID1" NUMBER,
  "ACCOUNTID1" VARCHAR2(1000),
  "RESOURCEIMAGEID" NUMBER,
  "CERTIFICATENUM" VARCHAR2(1000),
  "NATIVEPLACE" VARCHAR2(1000),
  "EDUCATIONLEVEL" NUMBER,
  "BEMEMBERDATE" DATE NULL,
  "BEPARTYDATE" DATE NULL,
  "WORKCODE" VARCHAR2(1000),
  "REGRESIDENTPLACE" VARCHAR2(1000),
  "HEALTHINFO" CHAR(1),
  "RESIDENTPLACE" VARCHAR2(1000),
  "POLICY" VARCHAR2(1000),
  "DEGREE" VARCHAR2(1000),
  "HEIGHT" VARCHAR2(640),
	"CLASSIFICATION" CHAR(1) DEFAULT 3,
	"DESCRIPTION" VARCHAR2 ( 2000 ) NULL,
	"OPERATOR" VARCHAR2 ( 255 ) NULL,
	"VERSION" NUMBER ( 9, 1 ) NULL,
	"OPERATE_TIME" DATE NULL,
	CONSTRAINT HRMRESOURCE_VERSION_PK PRIMARY KEY ( ID ) 
)
/
CREATE SEQUENCE HRMRESOURCE_VERSION_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE 
/ 

CREATE 
OR REPLACE TRIGGER HRMRES_VERSION_ID_TIGGER BEFORE INSERT ON HRMRESOURCE_VERSION FOR EACH ROW
BEGIN
	SELECT
		HRMRESOURCE_VERSION_ID.nextval INTO :new.ID 
	FROM
		dual;
	
END;
/