Kayshav.com
About Developer Oracle 19c Oracle 12c Technology Information Sitemap

JSON - Get_Keys
-- Oracle 19c: Get_Keys (key values) of a JSON 
-- document  

SET SERVEROUTPUT ON;

DECLARE
 jobj          JSON_OBJECT_T;
 jary          JSON_ARRAY_T;
 jkeylst       JSON_KEY_LIST;

BEGIN
  jary := new JSON_ARRAY_T;
  
  jobj := JSON_OBJECT_T.parse('{
    "Type":"Galaxy",
    "Name":"Milky Way",
    "Diameter (ly)":"120,000",
    "Star":"Sun"    
  }');

  jkeylst := jobj.get_keys;

  FOR idx IN 1..jkeylst.COUNT LOOP
     jary.append(jkeylst(idx));
  END LOOP;

  DBMS_OUTPUT.PUT_LINE(jary.to_string);
END;
/
  Oracle 19c


  Oracle 19c Index   JSON_Array   JSON_Object

  Lower Versions   11g Index   12c Index

Oracle registered trademark of Oracle Corporation.

Last Revised On: December 27th, 2021

  4329