logo
down
shadow

cannot get correct syntax for pljson


cannot get correct syntax for pljson

By : user2953942
Date : November 21 2020, 07:31 AM
this will help See ex8.sql. In particular, it says:
code :
l_id := json_ext.get_string(instance, 'Instances[1].InstanceId');
l_id := instance.path('Instances[1].InstanceId');


Share : facebook icon twitter icon
How to parse a json tree using plsql pljson framework?

How to parse a json tree using plsql pljson framework?


By : user3404442
Date : March 29 2020, 07:55 AM
Any of those help I was able to get lat, lng and location data using the below pljson code.
code :
 l_response_obj     json;
   l_resultObject   json;
   l_list           json_list;
   l_locationObject   json;
   l_geometryObject   json;

l_response_obj := json(l_entire_msg);
      l_list := json_list(l_response_obj.get ('results'));

  -- Grab the first item in the list
  l_resultObject := json(l_list.head);


  -- Show the location data
  l_geometryObject := json(l_resultObject.get ('geometry'));
  l_locationObject := json(l_geometryObject.get ('location'));
  -- dbms_output.put_line ('Lat = ' || locationObject.get ('lat').TO_CHAR ());
  -- dbms_output.put_line ('Lng = ' || locationObject.get ('lng').TO_CHAR ());

  p_o_lat := l_locationObject.get ('lat').TO_CHAR ();
  p_o_lng := l_locationObject.get ('lng').TO_CHAR ();
  p_o_formatted_addr :=
     l_resultObject.get ('formatted_address').TO_CHAR ();
Get json with pljson & plsql

Get json with pljson & plsql


By : Emma Li
Date : March 29 2020, 07:55 AM
wish of those help Printing json lists and objects differs from assigning them to some variables to manipulate them. I will try to answer your question through your example as follows:
code :
DECLARE
    obj json := json();
    obj_1 json := json();
    arr json_list := json_list();
    val NUMBER;
BEGIN
/*Create your object*/
    obj := json('{"Order":{"no":1,"batch":2,"id":3,"quantity":10,"sm_pack":[{"no":10,"id":1010,"quantity":2},{"no":11,"id":1040,"quantity":8}],"sm_size":[{"no":10,"id":1010,"quantity":2},{"no":11,"id":1040,"quantity":8}]}}');

/*Assign object*/
    obj_1 :=json(obj.get('Order'));

/*Assign list from within the object*/
    arr := json_list(obj_1.get('sm_pack'));
    arr.print;
    --or
    arr := json_list(json(obj.get('Order')).get('sm_pack'));
    arr.print;

/*Get object value from within list*/
    val := json_ext.get_number(json(arr.get(2)), 'id');
    DBMS_OUTPUT.PUT_LINE(VAL);

END;
/
pljson does 11g installation require specific actions

pljson does 11g installation require specific actions


By : Klosu
Date : March 29 2020, 07:55 AM
will help you The section you're asking about is lines 4 through 8 in the install.sql script:
code :
/*
11g
ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 3;
ALTER SESSION SET plsql_code_type = 'NATIVE';
*/
ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 2;
Reading data in an inner array with pljson

Reading data in an inner array with pljson


By : Nadhir
Date : March 29 2020, 07:55 AM
Any of those help Sample JSON: , Since you are working with the array, you should be able to simply:
code :
dbms_output.put_line( l_messages_list.get(j).to_char() );
Parse array of string in PLJSON oracle

Parse array of string in PLJSON oracle


By : ivar
Date : March 29 2020, 07:55 AM
Does that help REGROUPEMENT_COLORS is an array, not a string, so json_ext.get_string() is not returning anything. If you want a string then get REGROUPEMENT_COLORS[1] or REGROUPEMENT_COLORS[2]; if you want the array then use json_ext.get_json_list rather than json_ext.get_string.
To output a string use DBMS_OUTPUT.PUT_LINE not DBMS.
code :
DECLARE
  obj pljson := pljson(
    '{
      "DASHBOARD": {
        "userUid": "",
        "DATA_DASHBOARD": [
          {
            "CLE": "TESTTEST",
            "X": "",
            "Y": "",
            "COL": "",
            "ROW": "",
            "CLASSCOLOR": "",
            "COLORS": ["df","df"],
            "REGROUPEMENT_ID": "",
            "REGROUPEMENT_TEXT": "",
            "REGROUPEMENT_CLASSCOLOR": "",
            "REGROUPEMENT_X": "",
            "REGROUPEMENT_Y": "",
            "REGROUPEMENT_COL": "",
            "REGROUPEMENT_ROW": "",
            "REGROUPEMENT_COLORS": ["d","df"]
          }
        ]
      }
    }'
  );
  test varchar2(255);
  arr  pljson_list;
BEGIN
  test := pljson_ext.get_string( obj, 'DASHBOARD.DATA_DASHBOARD[1].REGROUPEMENT_COLORS[1]');
  DBMS_OUTPUT.PUT_LINE(test);
  arr := pljson_ext.get_json_list( obj, 'DASHBOARD.DATA_DASHBOARD[1].REGROUPEMENT_COLORS');
  arr.print;
  FOR i IN 1 .. arr.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE( arr.get_string(i) );
  END LOOP;
END;
/
d
["d", "df"]
d
df
Related Posts Related Posts :
  • AWS Cloudformation can not create stack when AWS::Cognito::IdentityPoolRoleAttachment resource has RoleMappings attribut
  • How to properly auto-scale AWS EC2 Instances group in a relatively complex infrastructures?
  • Storing Time Series in AWS DynamoDb
  • AWS lambda running shell script
  • on s3 upload to a bucket, trigger s3 copy to a different bucket
  • Running Map Reduce on a data set of around 10 GB on AWS
  • confused regading AWS lamda function execution limits
  • How can I use wildcards in `aws-cli ec2` commands?
  • Which one is better to user between Parse, Firebase and AWS Cognito?
  • Redirect Assets Using AWS S3 / CloudFront
  • Have custom Nginx error page when All backend servers unhealty
  • boto.sqs connect to non-aws endpoint
  • Is Fineuploader with File Chunking more expensive on Amazon S3?
  • Migrating DNS Service for an Existing Domain to Amazon Route 53
  • AWS giant data transfer
  • install redis on aws micro instance
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org