CREATE TABLE ITORCAMESGOP (
  NRITEMORCAOP NUMBER(10) NOT NULL, 
  NRITORCAMESGOP NUMBER(10) NOT NULL, 
  DTORCAMENTO DATE NOT NULL, 
  IDALTMANUAL VARCHAR2(1) DEFAULT 'N' NOT NULL, 
  VRORCAMENTO DOUBLE PRECISION DEFAULT NULL NULL, 
  VRREAJUSTE DOUBLE PRECISION DEFAULT NULL NULL, 
  VRPERCENTUAL DOUBLE PRECISION DEFAULT NULL NULL, 
  QTORCAMENTO DOUBLE PRECISION DEFAULT NULL NULL, 
  NRORG NUMBER(10) DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_ITORCAMESGOP PRIMARY KEY(NRITORCAMESGOP)
)
/
ALTER TABLE ITORCAMESGOP ADD CONSTRAINT CKC_IDALTMANUAL_ITORCAMESGOP CHECK (IDALTMANUAL IN ('S', 'N'))
/
ALTER TABLE ITORCAMESGOP ADD CONSTRAINT CKC_IDATIVO_ITORCAMESGOP CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE ITORCAMESGOP ADD CONSTRAINT FKGOP00690ITEMORCAGOP FOREIGN KEY (NRITEMORCAOP) REFERENCES ITEMORCAGOP (NRITEMORCAOP) ON DELETE CASCADE
/
CREATE INDEX FKGOP00690ITEMORCAGOP ON ITORCAMESGOP (NRITEMORCAOP)