Oracle Tutorial

DBMS_ALERT Examples

DBMS_ALERT.REGISTER

CREATE OR REPLACE PROCEDURE register (p_register in varchar2)
IS
BEGIN
DBMS_ALERT.REGISTER('alert_name');
END;


DBMS_ALERT.REMOVE

CREATE OR REPLACE PROCEDURE remove (p_remove in varchar2)
IS
BEGIN
DBMS_ALERT.REMOVE('alert_name');
END;


DBMS_ALERT.SIGNAL

CREATE OR REPLACE PROCEDURE signal (
p_name in varchar2,
p_message in varchar2
IS
BEGIN
DBMS_ALERT.SIGNAL('Alert_name', 'The message of alert');
END;



DBMS_ALERT.WAITONE

Declare
v_status varchar2(200);
v_message varchar2(1200);
Begin
dbms_alert.waitone( name => 'AlertName',
message => v_message,
status => v_status,
timeout => dbms_alert.maxwait );
If v_status = 'NO' Then
dbms_output.put_line( 'The message is ' || v_message );
End If;
End;