Documentation? Useful examples?

Andy Hardy
2010-02-22
2013-05-28
  • Andy Hardy

    Andy Hardy - 2010-02-22

    Hi,

    I came across this project from Lewis Cunningham's blog. In the blog the API seemed quite simple and specific e.g.

     -- create a json object
         v_json := json(); 
         -- add some members
         v_json.add_member('title', 'SQL Starter');
         v_json.add_member('author', 'LewisC');
         v_json.add_member('monkeyman', false);
         v_json.add_member('age', 21); 
         -- add a member array
         v_json.add_array('myarray', false, v_arr_id ); 
         -- Add some elements to the array
         v_json.add_array_element( v_arr_id, 'hello', false, v_ele_id );
         v_json.add_array_element( v_arr_id, 'goodbye', false, v_ele_id );
         v_json.add_array_element( v_arr_id, 'kerblooey', false, v_ele_id );
    

    In the current version, most of these functions/procedures/methods appear to have disappeared and the enclosed examples do not make it clear how to use the available functionality. All I really need at the moment is a way of returning JSON objects to FLOT e.g. something like [, , null, , ] to allow a chart plot. I can't see how to produce such an object using PL/JSON.

    Are there any working examples or documentation out there?

    Thanks,

     
  • Jonas Krogsboell

    Perhaps the examples should be improved - but not until next version is ready.

    declare
      outerlist json_list := json_list();
    begin
      outerlist.add_elem(json_list('[0,12]'));
      outerlist.add_elem(json_list('[7,12]'));
      outerlist.add_elem(json_null);
      outerlist.print;
    end;
    
     
  • Andy Hardy

    Andy Hardy - 2010-02-23

    Thanks, that does the trick!

     
  • Anonymous - 2013-05-01

    Does add_elem() still exist?

    isdev8b>@examples/ex70.sql
    declare outerlist json_list := json_list(); begin outerlist.add_elem(json_list('[0,12]')); outerlist.add_elem(json_list('[7,12]')); outerlist.add_elem(json_null); outerlist.print; end;
                                                                *
    ERROR at line 1:
    ORA-06550: line 1, column 61:
    PLS-00302: component 'ADD_ELEM' must be declared
    ORA-06550: line 1, column 51:
    PL/SQL: Statement ignored
    ORA-06550: line 1, column 102:
    PLS-00302: component 'ADD_ELEM' must be declared
    ORA-06550: line 1, column 92:
    PL/SQL: Statement ignored
    ORA-06550: line 1, column 152:
    PLS-00201: identifier 'JSON_NULL' must be declared
    ORA-06550: line 1, column 133:
    PL/SQL: Statement ignored
    
     
  • Anonymous - 2013-05-01

    Ah, I see…

    append()
    

    .  I'll try that.   :)

     
  • Anonymous - 2013-05-01

    For anyone else who stumbles upon this post, here's Jonas' code - updated for PL/JSON Version 1.0.4:

    declare 
      outerlist json_list := json_list();
    begin
      outerlist.append(json_list('[0,12]'));
      outerlist.append(json_list('[7,12]'));
      outerlist.append(json_value.makenull());
      outerlist.print;
    end;
    /
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks