Register Applications to Receive a Database Event
To register an application to receive database events, use the REGISTER DBEVENT statement:
REGISTER DBEVENT event_name
event_name
Specifies an existing database event.
Sessions must register for each database event to be received. A session can register for all database events that the session’s effective user owns, and all database events for which the effective user, group, role, or public has been granted REGISTER privilege. For each database event, the registration is in effect until the session issues the REMOVE DBEVENT statement or disconnects from the database.
The DBMS Server issues an error if:
• A session attempts to register for a non-existent database event
• A session attempts to register for a database event for which the session does not have register privilege
• A session attempts to register twice for the same database event. If the REGISTER DBEVENT statement is issued from within a transaction that is subsequently rolled back, the registration is not rolled back.
The REGISTER DBEVENT statement can be issued from interactive or embedded SQL, or from within a database procedure.