Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how access to json properties with utl_http.get_response ?

e8b08bb3-0d5b-441f-9b09-d3f78ae81cefJul 18 2017 — edited Jul 19 2017

Hi everyone , I have the following code , I'm using Oracle 11g Database

declare

    l_req  UTL_HTTP.REQ;

    l_resp UTL_HTTP.RESP;

    buffer varchar2(4000);

BEGIN

   -- UTL_HTTP.END_RESPONSE(l_resp);

    l_req := utl_http.begin_request(

        url    => 'http://10.50.32.210:8000/api/public_things/',

        method => 'GET'

    );

    l_resp := utl_http.get_response(r => l_req);

dbms_output.put_line(l_resp.ITEM_CODIGO);

   loop

      utl_http.read_line(l_resp, buffer);

      dbms_output.put_line(buffer);

    end loop;

    utl_http.end_response(r => l_resp);

EXCEPTION

when utl_http.end_of_body then

utl_http.end_response(l_resp);

  DBMS_OUTPUT.PUT_LINE('ok');

WHEN OTHERS THEN

utl_http.end_response(l_resp);

  DBMS_OUTPUT.PUT_LINE('error');

END;

this code work fine , and  the response is :

[{"ITEM_COD":"V0462723","ITEM_CLIENTE":"54","ITEM_TIPO":"DB","ITEM_ALTERNO":null,"ITEM_CODIGOUBICACION":null,"ITEM_PADRE":"S22995","ITEM_FECHA":"2011-10-21T23:53:07.000Z"},

{"ITEM_COD":"DBV","ITEM_CLIENTE":"43","ITEM_TIPO":"DB","ITEM_ALTERNO":null,"ITEM_CODIGOUBICACION":null,"ITEM_PADRE":"22995","ITEM_FECHA":"2011-10-21T23:53:07.000Z"}]

The question is , How I can access to ITEM CLIENTE or other json property key and get value in this response with pl/sql , anyone have any idea ?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2017
Added on Jul 18 2017
2 comments
7,681 views