25.19 GET_VARCHAR2 Function
This function returns a varchar2 member value. This function converts boolean and number values to varchar2 values.
Syntax
APEX_JSON.GET_VARCHAR2 (
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 BOOLEAN DEFAULT NULL,
p_values IN t_values DEFAULT g_values )
RETURN VARCHAR2;
Parameters
Table 25-22 GET_VARCHAR2 Function Parameters
Parameter | Description |
---|---|
|
Index into |
|
Each %N in |
|
The default value if the member does not exist. |
|
Parsed JSON members. The default is |
Returns/Raised Errors
Table 25-23 GET_VARCHAR2 Function Returns and Raised Errors
Return | Description |
---|---|
|
This is the value at the given path position. |
|
Raises this error if |
Example
This example parses a JSON string and prints 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_varchar2(p_path=>'items[%d].foo',p0=> 3,p_values=>j));
END;
Parent topic: APEX_JSON