33.18 GET_T_NUMBER Function
This function returns the numeric attributes of an array.
Syntax
function get_t_number (
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 wwv_flow_t_number;
Parameters
Table 33-21 GET_T_NUMBER Parameters
Parameter | Description |
---|---|
|
Index into |
|
Each %N in |
|
Parsed JSON members. The default is |
Returns
Array member values if the referenced t_value
is an array. An array with just the referenced value if it's type can be converted to a number.
Table 33-22 GET_T_NUMBER Function Raised Errors
Return | Description |
---|---|
|
On conversion errors. |
Example
This example parses a JSON string and prints the value at position 1.
declare
j apex_json.t_values;
l_elements apex_t_number;
begin
apex_json.parse(j, '{ "foo": [111, 222], "bar": 333 }');
l_elements := apex_json.get_t_number (
p_values => j,
p_path => 'foo' );
for i in 1 .. l_elements.count loop
sys.dbms_output.put_line(i||':'||l_elements(i));
end loop;
l_elements := apex_json.get_t_number (
p_values => j,
p_path => 'bar' );
for i in 1 .. l_elements.count loop
sys.dbms_output.put_line(i||':'||l_elements(i));
end loop;
end;
Output:
1:111
2:222
1:333
Parent topic: APEX_JSON