CREATE TABLE JUSTHORASNAOFATUCDA (
    NRJUSTHORASNAOFATUCDA   NUMBER NOT NULL,
    DSJUSTHORASNAOFATUCDA   VARCHAR2(500) NOT NULL,
    TAGJUSTHORASNAOFATUCDA  VARCHAR2(20) NOT 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 CK_IDATIVO_JUSTHRSNAOFATUCDA CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_JUSTHORASNAOFATUCDA PRIMARY KEY (NRJUSTHORASNAOFATUCDA)
)
/

ALTER TABLE FCT_APROPJUSTHRNFAT 
    ADD CONSTRAINT FKSM00456APRPJUSHRNFT_JUSHRNFT FOREIGN KEY (NRJUSTHORASNAOFATUCDA)
        REFERENCES JUSTHORASNAOFATUCDA (NRJUSTHORASNAOFATUCDA)
/

CREATE INDEX SM00456_FK ON FCT_APROPJUSTHRNFAT (NRJUSTHORASNAOFATUCDA ASC)
/