CREATE TABLE ALERTAGERACAOCARD (
    NRALERTAGERACAOCARD NUMBER 			NOT NULL,
    NRITGERACAOCARD     NUMBER 			NOT NULL,
    IDTIPOALERTA        VARCHAR2(30) 	NOT NULL,
    CODALERTA           VARCHAR2(250)	NOT NULL,
    DSALERTA            VARCHAR2(2000)  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 CKC_IDATIVO_ALERTAGERACAOCARD CHECK (IDATIVO IN ('S', 'N')),
		CONSTRAINT PK_ALERTAGERACAOCARD PRIMARY KEY (NRALERTAGERACAOCARD)
)
/
ALTER TABLE ALERTAGERACAOCARD ADD CONSTRAINT FKPLA01317ALERTAGERACAO_ITGER FOREIGN KEY (NRITGERACAOCARD) 
	REFERENCES ITGERACAOCARD (NRITGERACAOCARD) ON DELETE CASCADE
/
CREATE INDEX PLA01317_FK ON ALERTAGERACAOCARD (NRITGERACAOCARD)
/

ALTER TABLE ITGERACAOCARD ADD DTALERTA DATE NULL
/

ALTER TABLE ITGERACAOCARD ADD IDSTATUSALERTA VARCHAR2(30) NULL
/ 