CREATE TABLE ZH_USER_ALLOCATION (
  ID NUMBER(10) NOT NULL, 
  PRODUCT_ID NUMBER(10) NULL, 
  RELEASE_ID NUMBER(10) NULL, 
  SUBRELEASE_ID NUMBER(10) NULL, 
  USER_ID NUMBER(10) NOT NULL, 
  ORGANIZATION_ID NUMBER(10) DEFAULT 1 NOT NULL, 
  CREATED DATE DEFAULT SYSDATE NOT NULL, 
  CREATED_BY NUMBER(10) NOT NULL, 
  UPDATED DATE DEFAULT SYSDATE NOT NULL, 
  UPDATED_BY NUMBER(10) NOT NULL,
  CONSTRAINT ZH_USER_ALLOCATION_PK PRIMARY KEY(ID)
)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOCATION_PRODUCT_FK FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCT (ID)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOCATION_RELEASE_FK FOREIGN KEY (RELEASE_ID) REFERENCES RELEASE (ID)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOC_SUBRELEASE_FK FOREIGN KEY (SUBRELEASE_ID) REFERENCES SUBRELEASE (ID)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOCATION_ORG_FK FOREIGN KEY (ORGANIZATION_ID) REFERENCES ORGANIZATION (ID)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOCATION_USER_FK FOREIGN KEY (USER_ID) REFERENCES ZH_USER (ID)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOCATION_USER_FK1 FOREIGN KEY (CREATED_BY) REFERENCES ZH_USER (ID)
/
ALTER TABLE ZH_USER_ALLOCATION ADD CONSTRAINT ZH_USER_ALLOCATION_USER_FK2 FOREIGN KEY (UPDATED_BY) REFERENCES ZH_USER (ID)
/
CREATE SEQUENCE ZH_USER_ALLOCATION_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/