CREATE TABLE DOCUMENT_TEMPLATE (
  ORGANIZATION_ID NUMBER(10) NOT NULL, 
  ID NUMBER(10) NOT NULL, 
  CREATED_BY NUMBER(10) DEFAULT NULL NULL, 
  CREATED_AT DATE DEFAULT SYSDATE NOT NULL, 
  UPDATED_BY NUMBER(10) DEFAULT NULL NULL, 
  UPDATED_AT DATE DEFAULT SYSDATE NOT NULL, 
  NAME VARCHAR2(255) NOT NULL, 
  TYPE VARCHAR2(1) NOT NULL, 
  ATTACHMENT NUMBER(10) NOT NULL,
  CONSTRAINT PK_DOCUMENT_TEMPLATE PRIMARY KEY(ID)
)
/
ALTER TABLE DOCUMENT_TEMPLATE ADD CONSTRAINT FK_DOCUMENT_TEM_ATT FOREIGN KEY (ATTACHMENT) REFERENCES ATTACHMENT (ID)
/
CREATE SEQUENCE SEQ_DOCUMENT_TEMPLATE START WITH 1 MINVALUE 1 INCREMENT BY 1