CREATE TABLE TIPOPROTEINA (
	NRTIPOPROTEINA    NUMBER    	  NULL,
	NMTIPOPROTEINA    VARCHAR2(100)	  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_TIPOPROTEINA CHECK (IDATIVO IN ('S', 'N')),
		CONSTRAINT PK_TIPOPROTEINA PRIMARY KEY (NRTIPOPROTEINA)    
)
/

ALTER TABLE PARAMPRATFILIAL ADD NRTIPOPROTEINA NUMBER NULL
/

CREATE INDEX PLA01342_FK ON PARAMPRATFILIAL (NRTIPOPROTEINA ASC)
/

ALTER TABLE PARAMPRATFILIAL ADD 
	CONSTRAINT FKPLA01342TIPOPROT FOREIGN KEY (NRTIPOPROTEINA) 
		REFERENCES TIPOPROTEINA(NRTIPOPROTEINA) ON DELETE SET NULL
/