CREATE TABLE ETL_RESUSAPSERV
(
    CDSUPERVISOR    VARCHAR2(12)           NULL    ,
    CDGOPERAC       VARCHAR2(12)           NULL    ,
    CDEMPRESA       VARCHAR2(2)            NULL    ,
    CDFILIAL        VARCHAR2(4)            NULL    ,
    CDAREAGERE      VARCHAR2(3)            NULL    ,
    CDSEGMER        VARCHAR2(5)            NULL    ,
    CDFILISERVFILI  VARCHAR2(9)            NULL    ,
    CDTPFATSAPSERV  VARCHAR2(30)           NULL    ,
    ANETLSAPSERV    VARCHAR2(4)            NULL    ,
    MEETLSAPSERV    VARCHAR2(7)            NULL    ,
    BIETLSAPSERV    VARCHAR2(6)            NULL    ,
    TRETLSAPSERV    VARCHAR2(6)            NULL    ,
    SEETLSAPSERV    VARCHAR2(6)            NULL    ,
    VRCUSUNIACUPOND FLOAT                  NULL    ,
    VRCUSUNIAPADR   FLOAT                  NULL    ,    
    DTULTATUSAPSERV DATE                   DEFAULT SYSDATE
)
/

CREATE INDEX IDX_RESUSAPSERV01 ON ETL_RESUSAPSERV (CDSUPERVISOR ASC)
/

ALTER TABLE ETL_RESUSAPSERV
    ADD CONSTRAINT FK_RESUSAPSERV01OPERADOR FOREIGN KEY  (CDSUPERVISOR)
       REFERENCES OPERADOR (CDOPERADOR)
/

CREATE INDEX IDX_RESUSAPSERV02 ON ETL_RESUSAPSERV (CDGOPERAC ASC)
/

ALTER TABLE ETL_RESUSAPSERV
    ADD CONSTRAINT FK_RESUSAPSERV02OPERADOR FOREIGN KEY  (CDGOPERAC)
       REFERENCES OPERADOR (CDOPERADOR)
/

CREATE INDEX IDX_RESUSAPSERV03 ON ETL_RESUSAPSERV (CDEMPRESA ASC)
/

ALTER TABLE ETL_RESUSAPSERV
    ADD CONSTRAINT FK_RESUSAPSERV01EMPRESA FOREIGN KEY  (CDEMPRESA)
       REFERENCES EMPRESA (CDEMPRESA)
/

CREATE INDEX IDX_RESUSAPSERV04 ON ETL_RESUSAPSERV (CDFILIAL ASC)
/

ALTER TABLE ETL_RESUSAPSERV
    ADD CONSTRAINT FK_RESUSAPSERV01FILIAL FOREIGN KEY  (CDFILIAL)
       REFERENCES FILIAL (CDFILIAL)
/

CREATE INDEX IDX_RESUSAPSERV05 ON ETL_RESUSAPSERV (CDAREAGERE ASC)
/

ALTER TABLE ETL_RESUSAPSERV
    ADD CONSTRAINT FK_RESUSAPSERV01AREAGERE FOREIGN KEY  (CDAREAGERE)
       REFERENCES AREAGERE (CDAREAGERE)
/

CREATE INDEX IDX_RESUSAPSERV06 ON ETL_RESUSAPSERV (CDSEGMER ASC)
/

ALTER TABLE ETL_RESUSAPSERV
    ADD CONSTRAINT FK_RESUSAPSERV01SEGMERCADO FOREIGN KEY  (CDSEGMER)
       REFERENCES SEGMERCADO (CDSEGMER)
/

CREATE INDEX IDX_RESUSAPSERV07 ON ETL_RESUSAPSERV (CDFILISERVFILI ASC)
/

-- VERSAO --
BEGIN ATUVEROBJ('ETL_RESUSAPSERV','5.01.003'); END;
/
