33.6 DOES_EXIST Function
This function determines whether the given path points to an existing value.
Syntax
APEX_JSON.DOES_EXIST (
   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 BOOLEAN;Parameters
Table 33-1 DOES_EXIST Function Parameters
| Parameter | Description | 
|---|---|
| 
                               
  | 
                           
                               Index into   | 
                        
| 
                               
  | 
                           
                               Each %N in   | 
                        
| 
                               
  | 
                           
                               Parsed JSON members. The default is   | 
                        
Returns
Table 33-2 DOES_EXIST Function Returns
| Return | Description | 
|---|---|
| 
                               
  | 
                           
                               Given path points to an existing value.  | 
                        
| 
                               
  | 
                           
                               Given path does not point to an existing value  | 
                        
Example
This example parses a JSON string and prints whether it contains values under a path.
DECLARE 
    j apex_json.t_values; 
BEGIN 
    apex_json.parse(j, '{ "items": [ 1, 2, { "foo": true } ] }'); 
    if apex_json.does_exist(p_path => 'items[%d].foo', p0 => 3, p_values => 
j) then 
        dbms_output.put_line('found items[3].foo'); 
    end if; 
END;Parent topic: APEX_JSON