27.11 GET_CLOB Function

This function returns clob member value. This function auto-converts varchar2, boolean, and number values.

Syntax

GET_CLOB (
    p_path    IN VARCHAR2,
    p0        IN VARCHAR2 DEFAULT NULL,
    p1        IN VARCHAR2 DEFAULT NULL,
    p2        IN VARCHAR2 DEFAULT NULL,
    p3        IN VARCHAR2 DEFAULT NULL,
    p4        IN VARCHAR2 DEFAULT NULL,
    p_default IN CLOB DEFAULT NULL,
    p_values  in t_values DEFAULT g_values )
RETURN CLOB

Parameters

Table 27-7 GET_CLOB Function Parameters

Parameter Description
p_values Parsed JSON members. defaults to g_values.
p_path Index into p_values.
p[0-4] Each %N in p_path will be replaced by pN and every i-th %s or %d will be replaced by the p[i-1].
p_default Default value if the member does not exist.

Returns/Raised Errors

Table 27-8 GET_CLOB Function Returns and Raised Errors

Return/Raised Errors Description
a clob Value at the given path position.
VALUE_ERROR If p_values(p_path) is an array or an object.

Example

Parse a JSON string and print the value at a position.

DECLARE
    j apex_json.t_values;
BEGIN
    apex_json.parse(j, '{ "items": [ 1, 2, { "foo": 42 } ] }');
    dbms_output.put_line(apex_json.get_clob (
    p_values => j,
    p_path => 'items[%d].foo',
    p0 => 3));
END;