DBMS_OUTPUT

Syntax

The DBMS_OUTPUT statement is a call to one of the two supported procedures in the DBMS_OUTPUT system package. These procedures are useful to output the value of variables during execution as a debugging aid.
DBMS_OUTPUT.procedure( put_parameters );

put_parameters :=
  put_parameter [ || put_parameters]

put_parameter :=
    numeric
  | literal-character-string
Where,
procedure

Is either PUT or PUT_LINE. These procedures format and write their parameters to the UDF output file. The difference between PUT and PUT_LINE is that the latter terminates its output with a newline.

put_parameters

Separate multiple PUT parameters by the concatenation operator, ||. This operator combines all the parameters into a single output string.

literal-character-string
A string of characters enclosed in single quotes (').

Considerations

To obtain output from the DBMS_OUTPUT procedures, the output must be directed to an OSS file. Redirecting the output is done by assigning a value to the SQLMX_UDR_STDOUT environment variable. In the OSS shell, use an export command. For more information on the export command, see the export manpage.

Examples

Output a string and a variable with separate procedure calls:

DBMS_OUTPUT.PUT( ‘The result = ‘ );
DBMS_OUTPUT.PUT_LINE( grand_total );

Output several strings and variables in one PUT_LINE call:

DBMS_OUTPUT.PUT_LINE( ‘Error ‘ || err_num || ‘ in step ‘ || step_no );