CREATE TABLE HISTOLOTE 
(	NRHISTOLOTE       NUMBER,
    CDFILIAL          VARCHAR2(4) 	  NOT NULL,
    NRLOTEESTQ        VARCHAR2(20) 	  NOT NULL,
    NRSUBLOTE         VARCHAR2(4) 	  NOT NULL,
    CDPRODUTO         VARCHAR2(10)    NOT NULL,
    NRAUDITORIA       VARCHAR2(10)    NULL,
    DTVALILOTEORIG    DATE 		      NOT NULL,
    DTVALILOTEATU     DATE,
    DTULTATULOTE      DATE 			  DEFAULT SYSDATE,
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    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',
		CONSTRAINT CKC_IDATIVO_HISTOLOTE CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT HISTOLOTE_PK PRIMARY KEY ( NRHISTOLOTE ) 
)
/