REMOVE_PIPE v15
The REMOVE_PIPE
function deletes an explicit private or explicit public pipe.
<status> INTEGER REMOVE_PIPE(<pipename> VARCHAR2)
Use the REMOVE_PIPE
function to delete explicitly created pipes, that is, pipes created with the CREATE_PIPE
function.
Parameters
pipename
Name of the pipe.
status
Status code returned by the operation. A status code of 0
is returned even if the named pipe is nonexistent.
Examples
Two messages are sent on a pipe:
DECLARE v_status INTEGER; BEGIN v_status := DBMS_PIPE.CREATE_PIPE('pipe'); DBMS_OUTPUT.PUT_LINE('CREATE_PIPE status : ' || v_status); DBMS_PIPE.PACK_MESSAGE('Message #1'); v_status := DBMS_PIPE.SEND_MESSAGE('pipe'); DBMS_OUTPUT.PUT_LINE('SEND_MESSAGE status: ' || v_status); DBMS_PIPE.PACK_MESSAGE('Message #2'); v_status := DBMS_PIPE.SEND_MESSAGE('pipe'); DBMS_OUTPUT.PUT_LINE('SEND_MESSAGE status: ' || v_status); END; CREATE_PIPE status : 0 SEND_MESSAGE status: 0 SEND_MESSAGE status: 0
Receive the first message and unpack it:
DECLARE v_item VARCHAR2(80); v_status INTEGER; BEGIN v_status := DBMS_PIPE.RECEIVE_MESSAGE('pipe',1); DBMS_OUTPUT.PUT_LINE('RECEIVE_MESSAGE status: ' || v_status); DBMS_PIPE.UNPACK_MESSAGE(v_item); DBMS_OUTPUT.PUT_LINE('Item: ' || v_item); END; RECEIVE_MESSAGE status: 0 Item: Message #1
Remove the pipe:
SELECT DBMS_PIPE.REMOVE_PIPE('pipe') FROM DUAL;
Output
remove_pipe ------------- 0 (1 row)
Try to retrieve the next message. The RECEIVE_MESSAGE
call returns status code 1
indicating it timed out because the pipe was deleted.
DECLARE v_item VARCHAR2(80); v_status INTEGER; BEGIN v_status := DBMS_PIPE.RECEIVE_MESSAGE('pipe',1); DBMS_OUTPUT.PUT_LINE('RECEIVE_MESSAGE status: ' || v_status); END; RECEIVE_MESSAGE status: 1
- On this page
- Parameters
- Examples