json table 中的数据通过 Oracle APEX Web 服务

json data in table through oracle apex web service

我在 oracle apex 中创建了一个 Web 服务,returns 一个 json 数据。我用它来创建一个应用程序并在表单和报告页面中显示数据。但我希望数据以表格形式显示 format.Need 有助于以表格格式显示数据。

优先输出

A   KEY
B   VALUE

对于这个需求,您可以使用 2 个选项

1 使用 apex 的内置工具,您可以通过搜索找到示例 "consuming web services in apex" http://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/schema/50/Creating_RESTful_web_services/Creating_RESTful_web_services.html

2 您可以在 oracle sql 中使用 xmltable 函数,两个示例代码如下

这段代码展示了json处理

的逻辑
select col1 d, col2 r
from xmltable (
        '/json/verumObjectList/row'
        passing apex_json.to_xmltype('

    {
  "verumModelObjectName": "Address",
  "verumObjectList": [
    {
      "locationID": "20005",
      "country": "ARE"
    },
    {
      "locationID": "31125",
      "country": "AUS"
    }],
  "statusCode": 200
}

')
        columns
           col1 number path '/row/locationID',
           col2 varchar2(5) path '/row/country' );

或 此代码显示连接具有 json 服务

的远程服务器
           select  indexes ,types
from xmltable (
        '/json/hits/hits/row'
        passing apex_json.to_xmltype(APEX_WEB_SERVICE.MAKE_REST_REQUEST(
                    p_url               => 'YOUT_SERVICE_ADDRESS',
                    p_http_method       =>  'GET'))
        columns
           indexes varchar2(32) path '/row/_index',
           types varchar2(32) path '/row/_type',

);