29.12 GET_CLOB_OUTPUT Function

Returns the temporary CLOB that you created with INITIALIZE_CLOB_OUTPUT.

Syntax

APEX_JSON.GET_CLOB_OUTPUT (
    p_free  IN BOOLEAN  DEFAULT FALSE )
    RETURN CLOB;

Parameters

Table 29-9 GET_CLOB_OUTPUT Parameters

Parameter Description
p_free If true, frees output resources. Defaults to false.

Example 1

This example configures APEX_JSON for CLOB output, generates JSON, prints the CLOB with DBMS_OUTPUT, and finally frees the CLOB.

BEGIN
  apex_json.initialize_clob_output;

  apex_json.open_object;
  apex_json.write('hello', 'world');
  apex_json.close_object;

  dbms_output.put_line(apex_json.get_clob_output);

 apex_json.free_output;
END;

Example 2

This example configures APEX_JSON for CLOB output, generates JSON, and prints and frees the CLOB with DBMS_OUTPUT and GET_CLOB_OUTPUT.

BEGIN
  apex_json.initialize_clob_output;

  apex_json.open_object;
  apex_json.write('hello', 'world');
  apex_json.close_object;

  dbms_output.put_line(apex_json.get_clob_output( p_free => true ) );
END;