-- File: pipe_receive.sql
SET SERVEROUTPUT ON
DECLARE
  pipe_status INTEGER;
  message VARCHAR2(256);
BEGIN
  pipe_status := DBMS_PIPE.RECEIVE_MESSAGE('Pipe1', 120);

  IF pipe_status = 0 THEN
    DBMS_PIPE.UNPACK_MESSAGE(message);
    DBMS_OUTPUT.PUT_LINE(message);
  ELSE
    DBMS_OUTPUT.PUT_LINE('Message failed or timed out');
  END IF;
END;
/
