PROCEDURE performance_update (wait_time_in IN NUMBER) IS pipe_status INTEGER; production_total NUMBER; BEGIN /* Infinite loop to check production every hour */ LOOP /* || Read a message from the named pipe. Use the parameter value || to determine how long the program is willing to wait. */ pipe_status := DBMS_PIPE.RECEIVE_MESSAGE ('production', wait_time_in); /* Having retrieved the message, unpack and analyze data. */ IF pipe_status = 0 THEN DBMS_PIPE.UNPACK_MESSAGE (production_total); analyze_production (SYSDATE, production_total); ELSE RAISE_APPLICATION_ERROR (-20000, 'Unable to obtain production data.'); END IF; /* Wait for one hour (3600 seconds) to read the next message. */ DBMS_LOCK.SLEEP (3600); END IF; END;