CREATE TABLE AGENDATRIB (
    NRAGENDATRIB INTEGER NOT NULL,
    NMOBRIGACAO VARCHAR2(255) NOT NULL,
    IDTIPO VARCHAR2(100) NOT NULL,
    CDEMPRESA VARCHAR2(500) NOT NULL,
    IDTIPOINSC VARCHAR2 (1) NOT NULL,
    CDINSCRICAO VARCHAR2(500) NOT NULL,
    DTINICIAL DATE NOT NULL,
    IDALERTEMAIL VARCHAR2 (1) NOT NULL,
    NRQUANTDIAS INTEGER NULL,
    NRSEQLOTE INTEGER NULL,
	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_AGENDATRIB CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT CKC_IDTIPO_AGENDATRIB  CHECK (IDTIPO IN ('F','M','E')) ,
		CONSTRAINT CKC_IDTIPOINSC_AGENDATRIB  CHECK (IDTIPOINSC IN ('L','A','T')) ,
		CONSTRAINT CKC_IDALERTEMAIL_AGENDATRIB  CHECK (IDALERTEMAIL IN ('S','N')) 
)
/ 
CREATE SEQUENCE SEQ_NRAGENDATRIB START WITH 1 MINVALUE 1 INCREMENT BY 1
/  

CREATE SEQUENCE SEQ_NRSEQLOTE START WITH 1 MINVALUE 1 INCREMENT BY 1
/