The DBMS_OUTPUT system package allows users to send messages from stored procedures, packages, and triggers.
This system package is commonly used for debugging and displaying PL/SQL debugging information.
Using the PUT and PUT_LINE stored procedures of the DBMS_OUTPUT system package, you can place information in a buffer for other triggers, stored procedures, or packages to read. In separate PL/SQL subprograms or anonymous blocks, you can call GET_LINE or GET_LINES to display the buffered information.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Considerations
If you do not call
GET_LINE, the buffered messages will be ignored.Avoid calling the
DISABLEorENABLEstored procedures in application code, as it may affect the control of output by external tools.Notice
Information output by
DBMS_OUTPUTis sent only after the subprogram or trigger has completed execution. Currently, there is no mechanism to sendDBMS_OUTPUTinformation in real time to the client.
Data structures of DBMS_OUTPUT
The DBMS_OUTPUT system package defines the CHARARR table type and the DBMSOUTPUT_LINESARRAY object type, which are used together with the GET_LINES stored procedure.
CHARARR table type
The CHARARR table type is used together with GET_LINES to retrieve text submitted by PUT and PUT_LINE.
Syntax:
TYPE CHARARR IS TABLE OF VARCHAR2(32767) INDEX BY BINARY_INTEGER;
DBMSOUTPUT_LINESARRAY object type
The DBMSOUTPUT_LINESARRAY object type is a package-defined type that is used together with GET_LINES to retrieve text submitted by PUT and PUT_LINE.
Syntax:
TYPE DBMSOUTPUT_LINESARRAY IS
VARRAY(2147483647) OF VARCHAR2(32767);
Overview of DBMS_OUTPUT subprograms
The following table lists the DBMS_OUTPUT subprograms supported in the current version of OceanBase Database and their brief descriptions.
| Subprogram | Description |
|---|---|
| DISABLE | Disables message output. |
| ENABLE | Enables message output. |
| GET_LINE | Retrieves a line of data from the buffer. |
| GET_LINES | Retrieves a set of lines of data from the buffer. |
| NEW_LINE | Ends a line created by PUT. |
| PUT | Places part of a line of data in the buffer. |
| PUT_LINE | Places a line of data in the buffer. |
