Previous Table of Contents Next


Here are the procedures for DBMS_AQ:


PROCEDURE ENQUEUE(

     queue_name IN VARCHAR2,

     enqueue_options IN ENQUEUE_OPTIONS_T,

     message_properties IN  MESSAGE_PROPERTIES_T,

     payload IN message_type,

     msgid OUT RAW);

queue_name Queue to put the message in.
enqueue_options Enqueue options.
message_properties Message properties.
payload RAW or object type data. The queue must be created to hold data of the type passed here.
msgid Returned ID for message. Can be used to dequeue the message later.

This procedure is used to insert a message into the queue specified by queue_name:


PROCEDURE DEQUEUE(

     queue_name IN VARCHAR2,

     dequeue_options IN DEQUEUE_OPTIONS_T,

     message_properties OUT MESSAGE_PROPERTIES_T,

     payload OUT message_type,

     msgid OUT RAW);

queue_name Name of queue to search for messages.
dequeue_options Options available for dequeuing.
message_properties Properties of the message retrieved.
payload Message data.
msgid Message ID set by ENQUEUE.

This procedure is used to retrieve messages using the search criterion given in the consumer_name, msgid, and correlation fields of the dequeue_options record.

Upon retrieval, the message is either deleted or removed from the queue.

DBMS_OUTPUT

The DBMS_OUTPUT package is used mostly to communicate between processes running in the same session or for debugging. It allows you to create a buffer in your session and then write or read from that buffer. The buffer is stored in the SGA area, and its contents are not available until the PL/SQL unit for which it was created returns.


Tip:  
You can print to the screen in your SQL*Plus or Server Manager session by issuing the SET SERVEROUTPUT ON command. This command implicitly creates a buffer using DBMS_OUTPUT.ENABLE, and then prints anything in it with DBMS_OUTPUT.GET_LINES when the session ends. Just use DBMS_OUTPUT.PUT_LINE and pass in what you want to print at the end of the session.

PROCEDURE ENABLE(

     buffer_size IN INTEGER DEFAULT 2000);

Before you can actually store anything in the buffer, you need to create it using the ENABLE procedure. There is no name associated with the buffer, and it can only be accessed by routines running in the session where it is created. The ENABLE procedure can be called many times, but only one buffer can exist. The buffer size defaults to 2,000 bytes, which is the minimum, and can be as large as 1,000,000 bytes. If you call ENABLE more than once, the buffer size is set to the largest of the values provided. This procedure does not need to be called if you are using the SERVEROUTPUT ON option.


PROCEDURE DISABLE;

Once you are finished with the data in a buffer, you can purge it and close it using DISABLE. The buffer can be reused only after it is enabled again. If you’re using the SERVEROUTPUT ON option, you don’t need to run this procedure.


PROCEDURE PUT_LINE(

     item IN NUMBER, VARCHAR2 or DATE)

This procedure is used to put a line, followed by a new line marker, into the buffer. It is overloaded to accept NUMBER, VARCHAR2, and DATE data, but it converts them using the TO_CHAR procedure before storing them, so you should format your dates before passing them to the buffer.


PROCEDURE PUT(

     item IN NUMBER, VARCHAR2 or DATE)

PUT adds data to the current line but does not append a new line marker. This allows you to create a line with several PUT calls and then append your own new line marker manually. The new line marker is necessary for retrieval of the line using GET or GET_LINE.


PROCEDURE GET_LINE(

     line OUT VARCHAR2,

     status OUT INTEGER);

To retrieve a single line from the buffer, use GET_LINE. Along with the line itself, a status of 0 is returned for success and 1 if there are no more lines in the buffer.


Note:  
GET_LINE and GET_LINES will not retrieve any lines that are not ended with a new line marker.

PROCEDUR GET_LINES(

     lines OUT  CHARARR,

     numlines IN OUT  INTEGER);

This procedure acts like GET_LINE, except that it retrieves the specified number of lines into an array and does not return a status. When the DBMS_OUTPUT package is created, it creates CHARARR as a table of VARCHAR(255). This type is used to store the retrieved lines from the buffer. Using GET_LINES rather than GET_LINE can minimize your calls to the server. Like GET_LINE, this procedure will not return any line that does not end with a new line marker.


Note:  
All lines that are not retrieved before the next call to PUT_LINES, NEW_LINE, or PUT are discarded.

NEW_LINE;

This procedure puts a newline marker at the end of the current line in the buffer. A newline character is necessary to make the information retrievable, so you should use this after creating a line with PUT statements.


Previous Table of Contents Next
Используются технологии uCoz