-- ============================================================
--   Table: VAB_BENEFICIOCCT
-- ============================================================
CREATE TABLE VAB_BENEFICIOCCT
(
    NRBENEFICIOCCT NUMBER NOT NULL,
    NRCADASTROCCT NUMBER NOT NULL,
    NRTPBENEFICIO NUMBER NOT NULL,
    NRIDADEMAXSUBFILHOS NUMBER,         
    SEXOSUBSIDIOFILHO VARCHAR2(20),
    NRIDADEMAXSUBDEP NUMBER,         
    SEXOSUBSIDIODEP VARCHAR2(20),
    NREVETITULARVINC NUMBER,
    NRTIPOPARTICIPATITULAR VARCHAR2(20),
    NRTABFAIXASALTIT       VARCHAR2(500),
    VRTITULARSIND          FLOAT,
    VRTETOTITULARSIND      FLOAT,
    VRPISOTITULARSIND      FLOAT,
    NREVEDEPEVINC          NUMBER,
    NRTIPOPARTICIPADEP     VARCHAR2(20),
    NRTABFAIXASALDEP       VARCHAR2(500),
    VRDEPSIND              FLOAT,
    VRPISODEPSIND          FLOAT,
    VRTETODEPSIND          FLOAT,
    NRORG                  NUMBER 	      DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO                VARCHAR2(1)     DEFAULT 'S' NOT NULL
    	CONSTRAINT CKC_IDATIVO_VAB_BENEFICIOCCT CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			        NULL,
    DTULTATU          DATE                  			        NULL,
    NRORGINCLUSAO     NUMBER          DEFAULT 1 			NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		        NULL,
    NRORGULTATU       NUMBER          DEFAULT 1 			NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1',
    	CONSTRAINT PK_VAB_BENEFICIOCCT PRIMARY KEY (NRBENEFICIOCCT)
    
)
/
ALTER TABLE VAB_BENEFICIOCCT ADD CONSTRAINT FKHCM00077CADASTROCCT FOREIGN KEY (NRCADASTROCCT) REFERENCES FPA_CADASTROCCT (NRCADASTROCCT)
/

CREATE INDEX HCM00077_FK ON VAB_BENEFICIOCCT (NRCADASTROCCT ASC)
/

ALTER TABLE VAB_BENEFICIOCCT ADD CONSTRAINT FKHCM00078TPBENEFICIO FOREIGN KEY (NRTPBENEFICIO) REFERENCES TPBENEFICIO (NRTPBENEFICIO)
/

CREATE INDEX HCM00078_FK ON VAB_BENEFICIOCCT (NRTPBENEFICIO ASC)
/

ALTER TABLE VAB_BENEFICIOCCT ADD CONSTRAINT FKHCM00079FPA_EVENTOM_TIT FOREIGN KEY (NREVETITULARVINC) REFERENCES FPA_EVENTOM (NREVENTOM)
/

CREATE INDEX HCM00079_FK ON VAB_BENEFICIOCCT (NREVETITULARVINC ASC)
/

ALTER TABLE VAB_BENEFICIOCCT ADD CONSTRAINT FKHCM00080FPA_EVENTOM_DEP FOREIGN KEY (NREVEDEPEVINC) REFERENCES FPA_EVENTOM (NREVENTOM)
/

CREATE INDEX HCM00080_FK ON VAB_BENEFICIOCCT (NREVEDEPEVINC ASC)