DB2 Version 9.7 for Linux, UNIX, and Windows

SET_DEFAULTS - Set the polling interval for WAITONE and WAITANY

The SET_DEFAULTS procedure sets the polling interval that is used by the WAITONE and WAITANY procedures.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-DBMS_ALERT.SET_DEFAULTS--(--sensitivity--)------------------><

Procedure parameters

sensitivity
An input argument of type INTEGER that specifies an interval in seconds for the WAITONE and WAITANY procedures to check for signals. If a value is not specified, then the interval is 1 second by default.

Authorization

EXECUTE privilege on the DBMS_ALERT module.

Example

Use the SET_DEFAULTS procedure to specify the polling interval for the WAITONE and WAITANY procedures.

SET SERVEROUTPUT ON@

CREATE PROCEDURE proc1()
BEGIN
  DECLARE v_name    VARCHAR(30) DEFAULT 'alert_test';
  DECLARE v_msg     VARCHAR(80);
  DECLARE v_status  INTEGER;
  DECLARE v_timeout INTEGER DEFAULT 20;
  DECLARE v_polling INTEGER DEFAULT 3;
  CALL DBMS_ALERT.REGISTER(v_name);
  CALL DBMS_OUTPUT.PUT_LINE('Waiting for signal...');
  CALL DBMS_ALERT.SET_DEFAULTS(v_polling);
  CALL DBMS_OUTPUT.PUT_LINE('Polling interval: ' || v_polling);
  CALL DBMS_ALERT.WAITONE(v_name , v_msg , v_status , v_timeout);
  CALL DBMS_ALERT.REMOVE(v_name);
END@

CALL proc1@

This example results in the following output:

Polling interval : 3