The DBMS_OUTPUT package allows you to send messages from stored procedures, packages, and triggers.
This package is mostly used for debugging and can display PL debugging information.
You can call the PUT or PUT_LINE stored procedure in the DBMS_OUTPUT package to put information in the buffer for other triggers, stored procedures, or packages to read. In a standalone PL subprogram or anonymous block, you can call the GET_LINE or GET_LINES stored procedure to display the buffered information.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Considerations
Messages in the buffer will be ignored if you do not call
GET_LINE.Generally, you should avoid having applications call the
DISABLEorENABLEstored procedure, because this might affect the display control of external tools.Notice
DBMS_OUTPUTonly starts sending messages as requested by a subprogram or trigger after the subprogram or trigger completes its execution. Real-time messaging betweenDBMS_OUTPUTand the client is not supported.
Data structure
The DBMS_OUTPUT package defines the CHARARR table type and the DBMSOUTPUT_LINESARRAY object type, which are used with the GET_LINES stored procedure.
CHARARR table type
You can use the CHARARR table type with the GET_LINES stored procedure to obtain the text submitted by the PUT and PUT_LINE stored procedures.
The syntax is as follows:
TYPE CHARARR IS TABLE OF VARCHAR2(32767) INDEX BY BINARY_INTEGER;
DBMSOUTPUT_LINESARRAY object type
The DBMSOUTPUT_LINESARRAY object type is defined outside the package. You can use it with the GET_LINES stored procedure to obtain the text submitted by the PUT and PUT_LINE stored procedures.
The syntax is as follows:
TYPE DBMSOUTPUT_LINESARRAY IS
VARRAY(2147483647) OF VARCHAR2(32767);
Subprograms
The following table describes the DBMS_OUTPUT subprograms supported by the current OceanBase Database version.
| Subprogram | Description |
|---|---|
| DISABLE | Disables the output of messages. |
| ENABLE | Enables the output of messages. |
| GET_LINE | Retrieves a line from the buffer. |
| GET_LINES | Retrieves a set of lines from the buffer. |
| NEW_LINE | Terminates the line that was created with PUT. |
| PUT | Puts some lines in the buffer. |
| PUT_LINE | Puts a single line in the buffer. |