 CREATE TABLE PRIORIZAOLFILDEST
(
NRPRIORIZAOLFILDEST NUMBER 		NOT NULL,
CDFILIOPELOG 	VARCHAR2(4) 	NOT NULL, 
CDFILDEST     	VARCHAR2(4) 	NOT NULL, 
NRPRIORIDADE 	NUMBER 			NOT NULL,     
NRORG           NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
IDATIVO         VARCHAR2(1)  	DEFAULT 'S' NOT NULL
CONSTRAINT CKC_IDATIVO_PRIORIZAOLFILDEST CHECK (IDATIVO IN ('S','N')),  
DTINCLUSAO      DATE            DEFAULT SYSDATE,
CDOPERINCLUSAO  VARCHAR2(12) 	DEFAULT '1' NULL,
DTULTATU        DATE            DEFAULT SYSDATE,
NRORGINCLUSAO   NUMBER       	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')   NULL,
NRORGULTATU     NUMBER       	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')   NULL,
CDOPERULTATU    VARCHAR2(12) 	DEFAULT '1' NULL,
    
CONSTRAINT PK_NRPRIORIZAOLFILDEST PRIMARY KEY(NRPRIORIZAOLFILDEST)
)
/

ALTER TABLE PRIORIZAOLFILDEST ADD CONSTRAINT UN_PRIORIZAOLFILDEST UNIQUE (NRPRIORIZAOLFILDEST, CDFILIOPELOG, CDFILDEST, NRPRIORIDADE)
/

ALTER TABLE PRIORIZAOLFILDEST ADD CONSTRAINT FKOPL00002FILIAL FOREIGN KEY (CDFILIOPELOG) REFERENCES FILIAL(CDFILIAL)
/

ALTER TABLE PRIORIZAOLFILDEST ADD CONSTRAINT FKOPL00003FILIAL FOREIGN KEY (CDFILDEST) REFERENCES FILIAL(CDFILIAL)
/

CREATE INDEX FKOPL00002FILIAL ON PRIORIZAOLFILDEST (CDFILIOPELOG)
/

CREATE INDEX FKOPL00003FILIAL ON PRIORIZAOLFILDEST (CDFILDEST)
/ 