The DBMS_OUTPUT system package enables you to send messages from stored procedures, packages, and triggers.
This system package is typically used for debugging and displays PL debugging information.
The PUT and PUT_LINE stored procedures of the DBMS_OUTPUT system package allow you to place information in a buffer for other triggers, stored procedures, or packages to read. In a standalone PL/SQL subprogram or anonymous block, you can call GET_LINE or GET_LINES to display the buffered information.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL-compatible mode.
Usage of DBMS_OUTPUT
If
GET_LINEis not called, the buffered messages will be ignored.It is generally recommended to avoid calling the
DISABLEorENABLEstored procedure from application code, as this may affect external tools' ability to control the display output.Notice
The information output by
DBMS_OUTPUTwill not be sent until the subprogram or trigger has completed execution. Currently, there is no mechanism to sendDBMS_OUTPUT-output information to the client in real time.
DBMS_OUTPUT data structure
The DBMS_OUTPUT system package defines the CHARARR table type and the DBMS_OUTPUT_LINESARRAY object type, which are used together with the GET_LINES stored procedure.
CHARARR data type
The CHARARR table type, used together with GET_LINES, allows you to retrieve text submitted via PUT and PUT_LINE.
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. It is used together with GET_LINES to retrieve text submitted via PUT and PUT_LINE.
The syntax is as follows:
TYPE DBMSOUTPUT_LINESARRAY IS
VARRAY(2147483647) OF VARCHAR2(32767);
Overview of DBMS_OUTPUT Subprograms
The following table lists the DBMS_OUTPUT subprograms supported by the current version of OceanBase Database and provides brief descriptions.
Subprogram |
Description |
|---|---|
| DISABLE | Disable message output. |
| ENABLE | Enable message output. |
| GET_LINE | Retrieves a row of data from the buffer. |
| GET_LINES | Retrieves a set of row data from the buffer. |
| NEW_LINE | Terminate withPUTThe created row. |
| PUT | Put some row data into the buffer. |
| PUT_LINE | Places a single row of data into the buffer. |
