Search code examples
jsonoracle-databasejson-query

Oracle reading JSON data using json_query


While working on oracle json datatype and trying to extract data from it, not able to extract name & value elements from this. tried using all known notations but getting null.

select json_query(po_document, '$.actions.parameters[0]') from j_purchaseorder where ID='2';

sql output


Solution

  • You can use the JSON_VALUE function as follows:

    SQL> select JSON_VALUE('{"_class":"123", "name":"tejash","value":"so"}', '$.name') as name,
      2     JSON_VALUE('{"_class":"123", "name":"tejash","value":"so"}', '$.value') as value
      3  from dual;
    
    NAME       VALUE
    ---------- ----------
    tejash     so
    
    SQL>