29.23 INITIALIZE_CLOB_OUTPUT Procedure
This procedure initializes the output interface to write to a temporary CLOB. The default is to write to SYS.HTP. If using CLOB output, call FREE_OUTPUT() at the end to free the CLOB.
                  
Syntax
APEX_JSON.INITIALIZE_CLOB_OUTPUT (
    p_dur         IN PLS_INTEGER DEFAULT sys.dbms_lob.call,
    p_cache       IN BOOLEAN     DEFAULT TRUE,
    p_indent      IN PLS_INTEGER DEFAULT NULL,
    p_preserve    IN BOOLEAN     DEFAULT FALSE )Parameters
Table 29-31 INITIALIZE_CLOB_OUTPUT Procedure Parameters
| Parameter | Description | 
|---|---|
| p_dur | Duration of the temporary CLOB. this can beDBMS_LOB.SESSIONorDBMS_LOB.CALL(the default). | 
| p_cache | Specifies if the lob should be read into buffer cache or not. | 
| p_indent | Indent level. Defaults to 2 if debug is turned on, 0 otherwise. | 
| p_preserve | Whether to preserve the currently active output object. After calling  If HTP output has already been initialized and a CLOB needs to be created, use  If  | 
Example
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( p_preserve => true );
  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;Parent topic: APEX_JSON