The DBMS_ALERT package lets you register for, send, and receive alerts. The following table lists the supported procedures:
| Function/procedure | Return type | Description |
|---|---|---|
REGISTER(name) | n/a | Register to be able to receive alerts named name. |
REMOVE(name) | n/a | Remove registration for the alert named name. |
REMOVEALL | n/a | Remove registration for all alerts. |
SIGNAL(name, message) | n/a | Signal the alert named name with message. |
WAITANY(name OUT, message OUT, status OUT, timeout) | n/a | Wait for any registered alert to occur. |
WAITONE(name, message OUT, status OUT, timeout) | n/a | Wait for the specified alert, name, to occur. |
EDB Postgres Advanced Server's implementation of DBMS_ALERT is a partial implementation when compared to Oracle's version. Only those functions and procedures listed in the table are supported.
EDB Postgres Advanced Server allows a maximum of 500 concurrent alerts. You can use the dbms_alert.max_alerts GUC variable, located in the postgresql.conf file, to specify the maximum number of concurrent alerts allowed on a system.
To set a value for the dbms_alert.max_alerts variable, open the postgresql.conf file, which is located by default in /opt/PostgresPlus/14AS/data, with your choice of editor. Edit the dbms_alert.max_alerts parameter as shown:
dbms_alert.max_alerts = alert_count
alert_count
alert_count specifies the maximum number of concurrent alerts. By default, the value of dbms_alert.max_alerts is 100. To disable this feature, set dbms_alert.max_alerts to 0.
For the dbms_alert.max_alerts GUC to function correctly, the custom_variable_classes parameter must contain dbms_alerts:
custom_variable_classes = 'dbms_alert, …'
After editing the postgresql.conf file parameters, you must restart the server for the changes to take effect.
REGISTER
The REGISTER procedure enables the current session to be notified of the specified alert.
REGISTER(<name> VARCHAR2)
Parameters
name
Name of the alert to register.
Examples
This anonymous block registers for an alert named alert_test and then waits for the signal.