CREATE TABLE NOTAMAPAEXBAD
(
    CDVENDEDOR        VARCHAR2(4)       NOT NULL,
    CDFILICOMIS       VARCHAR2(4)       NOT NULL,
    NRMAPACOMIS       VARCHAR2(10)      NOT NULL,
    CDFILIALNF        VARCHAR2(4)       NOT NULL,
    NRLANCTONF        VARCHAR2(10)      NOT NULL,
    IDTPNOTAAD        VARCHAR2(1)       NULL,
    VRABATDEV         FLOAT             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_NOTAMAPAEXBAD CHECK (IDATIVO IN ('S','N')),
        CONSTRAINT CKC_IDTPNOTAAD_NOTAMAPA CHECK (IDTPNOTAAD is null or (IDTPNOTAAD IN ('A','D'))),
        CONSTRAINT PK_NOTAMAPAEXBAD PRIMARY KEY (CDVENDEDOR, CDFILICOMIS, NRMAPACOMIS, CDFILIALNF, NRLANCTONF)
)
/