ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling
complimentary technical Workshops on Database Security for the first 30
Oracle Database customers located anywhere in North America, EMEA, LATAM, or
APAC that send an email to
asra_us@oracle.com. Request a Workshop for
your organization today.
Purpose
Allow sessions to pass information between them through named SGA memory "pipes"
Generated if the buffer contains no more items, or if the item is not of the same type as that requested
ORA-06558
Generated if message buffer overflows (currently 4096 bytes). Each item in the buffer takes one byte for the type, two bytes for the length, plus the actual data. There is also one byte needed to terminate the message.
ORA-06559
Generated if the buffer contains no more items, or if the item is not of the same type as that requested
First Available
7.3.4
Security Model
Owned by SYS with EXECUTE granted to the EXECUTE_CATALOG_ROLE role and SYSBACKUP.
dbms_pipe.create_pipe(
pipename IN VARCHAR2,
maxpipesize IN INTEGER DEFAULT 8192,
private IN BOOLEAN DEFAULT TRUE,
global IN BOOLEAN DEFAULT FALSE)
RETURN INTEGER;
desc v$db_pipes
SELECT * FROM v$db_pipes;
set serveroutput on
DECLARE
retval INTEGER;
BEGIN
retval := dbms_pipe.create_pipe('UWPIPE');
dbms_output.put_line(retval);
END;
/
SELECT * FROM v$db_pipes;
DECLARE
retval INTEGER;
BEGIN
retval := dbms_pipe.remove_pipe('UWPIPE');
dbms_output.put_line(retval);
END;
/
Creates a name that is unique among all sessions currently connected to the database. Multiple calls to this routine from the same session will always return the same value.
dbms_pipe.unique_session_name RETURN VARCHAR2;
DECLARE
retval VARCHAR2(128);
BEGIN
retval := dbms_pipe.unique_session_name;
dbms_output.put_line(retval);
END;
/
CREATE OR REPLACE PACKAGE message_api AUTHID DEFINER AS
PROCEDURE send (p_number IN NUMBER, p_text IN VARCHAR2, p_date IN DATE DEFAULT SYSDATE);
PROCEDURE receive;
END message_api;
/
CREATE OR REPLACE PACKAGE BODY message_api AS
---------------------------------------------
PROCEDURE send (p_number IN NUMBER, p_text IN VARCHAR2, p_date IN DATE DEFAULT SYSDATE) AS
l_status NUMBER;
BEGIN
dbms_pipe.pack_message(p_number);
dbms_pipe.pack_message(p_text);
dbms_pipe.pack_message(p_date);
l_status := dbms_pipe.send_message('message_pipe');
IF l_status != 0 THEN
RAISE_APPLICATION_ERROR(-20001, 'message_pipe error');
END IF;
END;
---------------------------------------------
PROCEDURE receive AS
l_result INTEGER;
l_number NUMBER;
l_text VARCHAR2(32767);
l_date DATE;
BEGIN
l_result := dbms_pipe.receive_message(pipename => 'message_pipe', timeout => dbms_pipe.maxwait);
IF l_result = 0 THEN
-- message received successfully
dbms_pipe.unpack_message(l_number);
dbms_pipe.unpack_message(l_text);
dbms_pipe.unpack_message(l_date);
dbms_output.put_line('l_number: ' || l_number);
dbms_output.put_line('l_text : ' || l_text);
dbms_output.put_line('l_date : ' || l_date);
ELSE
RAISE_APPLICATION_ERROR(-20002, 'message_api.receive was unsuccessful. Return result: ' || l_result);
END IF;
END receive;
---------------------------------------------
END message_api;
/