CREATE TABLE ZH_WORDS_REPOSITORY (
  ID NUMBER(10) NOT NULL, 
  WORDS_ID NUMBER(10) NOT NULL, 
  REPOSITORY_ID NUMBER(10) NOT NULL, 
  CREATED_BY VARCHAR2(255) NOT NULL, 
  UPDATED_BY VARCHAR2(255) NOT NULL, 
  CREATED DATE NOT NULL, 
  UPDATED DATE NOT NULL, 
  IS_ACTIVE VARCHAR2(1) DEFAULT 'Y' NOT NULL,
  CONSTRAINT WORDS_REPOSITORY_PK PRIMARY KEY(ID)
)
/
ALTER TABLE ZH_WORDS_REPOSITORY ADD CONSTRAINT WORDS_REPOSITORY_REPOSITORY_FK FOREIGN KEY (REPOSITORY_ID) REFERENCES REPOSITORY (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_WORDS_REPOSITORY ADD CONSTRAINT WORDS_REPOSITORY_WORDS_FK FOREIGN KEY (WORDS_ID) REFERENCES ZH_WORDS (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_WORDS_REPOSITORY ADD CONSTRAINT CHECK_WORDS_REPO_ACTIVE CHECK ((IS_ACTIVE IN ('Y', 'N')))
/
CREATE TABLE ZH_WORDS_TRL (
  ID NUMBER(10) NOT NULL, 
  WORDS_ID NUMBER(10) NOT NULL, 
  LANGUAGE_ID NUMBER(10) NOT NULL, 
  VALUE VARCHAR2(4000) NOT NULL, 
  STATUS VARCHAR2(1) DEFAULT 'T' NOT NULL, 
  IS_ACTIVE VARCHAR2(1) DEFAULT 'Y' NOT NULL, 
  PRIMARY_VALUE VARCHAR2(4000) NOT NULL, 
  ORGANIZATION_ID NUMBER(10) NOT NULL, 
  CREATED DATE NOT NULL, 
  UPDATED DATE NOT NULL, 
  CREATED_BY VARCHAR2(255) NOT NULL, 
  UPDATED_BY VARCHAR2(255) NOT NULL,
  CONSTRAINT WORDS_TRL_PK PRIMARY KEY(ID)
)
/
ALTER TABLE ZH_WORDS_TRL ADD CONSTRAINT WORDS_TRL_WORDS_FK FOREIGN KEY (WORDS_ID) REFERENCES ZH_WORDS (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_WORDS_TRL ADD CONSTRAINT WORDS_TRL_LANGUAGE_FK FOREIGN KEY (LANGUAGE_ID) REFERENCES ZH_LANGUAGE (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_WORDS_TRL ADD CONSTRAINT CHECK_W_TRL_ACTIVE CHECK (("IS_ACTIVE"='N' OR "IS_ACTIVE"='Y'))
/
ALTER TABLE ZH_WORDS_TRL ADD CONSTRAINT CHECK_W_TRL_STATUS CHECK ((STATUS IN ('A', 'T')))

