33.20 GET_VALUE Function
This function returns the t_value.
Syntax
APEX_JSON.GET_VALUE (
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_values IN t_values DEFAULT g_values )
RETURN t_value;
Parameters
Table 33-25 GET_VALUE Function Parameters
Parameter | Description |
---|---|
|
Index into |
|
Each %N in |
|
Parsed JSON members. The default is |
Returns/Raised Errors
Table 33-26 GET_VALUE Function Returns and Raised Errors
Return | Description |
---|---|
|
The |
|
Raises this error if |
Example
This example parses a JSON string and prints attributes of values at positions.
DECLARE
j apex_json.t_values;
v apex_json.t_value;
BEGIN
apex_json.parse(j, '{ "foo": 3, "bar": [1, 2, 3, 4] }');
v := apex_json.get_value(p_path=>'bar[%d]',p0=> 2,p_values=>j); -- returns the t_value for bar[2]
dbms_output.put_line(v.number_value); -- 2
v := apex_json.get_value(p_path=>'does.not.exist',p_values=>j);
dbms_output.put_line(case when v.kind is null then 'not found!' end);
END;
Parent topic: APEX_JSON