CREATE TABLE OP_FLUXO_INTEGRA
(
   CDFILIAL     	 VARCHAR2(4),
   NRORDPROD    	 VARCHAR2(10),
   NRSUBORDPROD 	 VARCHAR2(1),
   OPNUM        	 VARCHAR2(11),
   OP_PRD       	 VARCHAR2(20),
   OP_PRDNAME   	 VARCHAR2(50),
   OP_QTY       	 FLOAT,
   OP_PL        	 INTEGER,
   OP_DATE      	 DATE,
   MAX_PAGE     	 INTEGER,
   NRORG             NUMBER 	     DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
      CONSTRAINT CKC_IDATIVO_OP_FLUXO_INTEGRA CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO        DATE            DEFAULT SYSDATE,
   DTULTATU          DATE            DEFAULT SYSDATE,
   NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
   CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 					NULL,
   NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
   CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/

CREATE TABLE OP_PRD_INTEGRA
(
   CDFILIAL          VARCHAR2(4),
   CDPRODUTO         VARCHAR2(10),
   NRLOTEESTQ        VARCHAR2(20),
   NRSUBLOTE         VARCHAR2(4),
   NRORDPROD         VARCHAR2(10),
   NRSUBORDPROD      VARCHAR2(1),
   CDGTIN            VARCHAR2(14),
   NRREGISTROANVISA  VARCHAR2(20),
   SERIAL_INI        VARCHAR2(20),
   SERIAL_FIN        VARCHAR2(20),
   DTVALIDLOTE       VARCHAR2(6),
   LOTE              VARCHAR2(20),
   PAGES             INTEGER,
   BATCH             VARCHAR2(20),
   EXPDATE           VARCHAR2(8),
   MFGDATE           VARCHAR2(8),
   DTEXPORTA         DATE,
   PRD_ID            VARCHAR2(20),
   NAME              VARCHAR2(20),
   NRORG             NUMBER 	     DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
      CONSTRAINT CKC_IDATIVO_OP_PRD_INTEGRA CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO        DATE            DEFAULT SYSDATE,
   DTULTATU          DATE            DEFAULT SYSDATE,
   NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
   CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 					NULL,
   NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
   CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/