


DROP TABLE OMALERT.OM_ALERT_TRIGGER CASCADE CONSTRAINTS ;
/
CREATE TABLE OMALERT.OM_ALERT_TRIGGER (
  TRIGGER_ID              NUMBER (10)   NOT NULL,
  TRIGGER_NAME            VARCHAR2 (30)  NOT NULL,
  TRIGGER_DESCRIPTION     VARCHAR2 (100),
  TEXT_ID                 NUMBER (10)   NOT NULL,
  SENDER_ID               NUMBER (10)   NOT NULL,
  TRIGGER_SCHEMA          VARCHAR2 (30)  NOT NULL,
  TRIGGER_INSERT          NUMBER (1),
  TRIGGER_UPDATE          NUMBER (1),
  TRIGGER_DELETE          NUMBER (1),
  TRIGGER_EACHROW         NUMBER (1),
  TRIGGER_WHEN            VARCHAR2 (1000),
  TRIGGER_AFTERBEFORE     NUMBER (1),
  TRIGGER_BODY            VARCHAR2 (4000),
  TRIGGER_COLUMN_SHUTTLE  VARCHAR2 (1000),
  CONSTRAINT OM_ALERT_TRIGGER_PK
  PRIMARY KEY ( TRIGGER_ID ) ) ;
/

ALTER TABLE OMALERT.OM_ALERT_TRIGGER ADD  CONSTRAINT OM_ALERT_TRIGGER_NAME_UK
 UNIQUE (TRIGGER_SCHEMA, TRIGGER_NAME) ;
/



GRANT ALTER ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

GRANT DELETE ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

GRANT INDEX ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

GRANT INSERT ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

GRANT SELECT ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

GRANT UPDATE ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

GRANT REFERENCES ON OMALERT.OM_ALERT_TRIGGER TO PUBLIC;
/

ALTER TABLE OMALERT.OM_ALERT_TRIGGER ADD  CONSTRAINT OM_ALERT_TRIGGER_SENDER
 FOREIGN KEY (SENDER_ID)
  REFERENCES OMALERT.OM_ALERT_SENDER (SENDER_ID) ;
/

ALTER TABLE OMALERT.OM_ALERT_TRIGGER ADD  CONSTRAINT OM_ALERT_TRIGGER_TEXT
 FOREIGN KEY (TEXT_ID)
  REFERENCES OMALERT.OM_ALERT_TEXT (TEXT_ID) ;
/




CREATE PUBLIC SYNONYM OM_ALERT_TRIGGER FOR OMALERT.OM_ALERT_TRIGGER;
/
