DB2 Version 9.7 for Linux, UNIX, and Windows

CREATE_PIPE function - Create a pipe

The CREATE_PIPE function explicitly creates a public or private pipe with the specified name.

For more information about explicit public and private pipes, see the topic about the DBMS_PIPE module.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-DBMS_PIPE.CREATE_PIPE--(--pipename--,--+-------------+--,--+---------+--)-><
                                          '-maxpipesize-'     '-private-'      

Return value

This function returns the status code 0 if the pipe is created successfully.

Function parameters

pipename
An input argument of type VARCHAR(128) that specifies the name of the pipe. For more information about pipes, see DBMS_PIPE module.
maxpipesize
An optional input argument of type INTEGER that specifies the maximum capacity of the pipe in bytes. The default is 8192 bytes.
private
An optional input argument that specifies the access level of the pipe:
For non-partitioned database environments
A value of "0" or "FALSE" creates a public pipe.
A value of "1" or "TRUE creates a private pipe. This is the default.
In a partitioned database environment
A value of "0" creates a public pipe.
A value of "1" creates a private pipe. This is the default.

Authorization

EXECUTE privilege on the DBMS_PIPE module.

Example

Example 1: Create a private pipe that is named messages:

SET SERVEROUTPUT ON@ 

CREATE PROCEDURE proc1()
BEGIN
  DECLARE	v_status        INTEGER;
  SET v_status = DBMS_PIPE.CREATE_PIPE('messages');
  DBMS_OUTPUT.PUT_LINE('CREATE_PIPE status: ' || v_status);
END@

CALL proc1@

This example results in the following output:

CREATE_PIPE status: 0

Example 2: Create a public pipe that is named mailbox:

SET SERVEROUTPUT ON@ 

CREATE PROCEDURE proc2()
BEGIN
  DECLARE	v_status INTEGER;
  SET v_status = DBMS_PIPE.CREATE_PIPE('mailbox',0);
  DBMS_OUTPUT.PUT_LINE('CREATE_PIPE status: ' || v_status);
END@

CALL proc2@

This example results in the following output:

CREATE_PIPE status: 0