当前位置:网站首页>oracle将restful接口封装到视图中
oracle将restful接口封装到视图中
2022-08-05 01:19:00 【贤时间】
oracle环境下有时候会需要访问到第三方发布webservice接口,有时候我们突发奇想,要是访问这些接口就如访问本地表一样就好了,如下是实现方法
数据示例
如下是一段是一个接口返回的简单的实例
{
"code": 200,
"data": [
{
"parent": "B01",
"name": "xxxxx",
"code": "B0101",
"enable_flag": "Y",
"los_date": ""
},
{
"parent": "B0101",
"name": "gggggggggg",
"code": "B010105",
"enable_flag": "Y",
"los_date": ""
}
]
}
具体实现
这里用到了两个工具:oracle apex 和 三方开源库 pljson,轻松实现
CREATE OR REPLACE VIEW XXXXX_V AS
SELECT json.status_code,
budget_dept_code,
budget_dept_name,
parent_code,
enable_flag,
end_active_date
FROM TABLE(pljson_table.json_table(apex_web_service.make_rest_request(p_url => 'https://blog.csdn.net/x6_9x',
p_http_method => 'GET',
p_wallet_path => xxx_ysx_yyds.get_wallet_path,
p_wallet_pwd => xxx_ysx_yyds.get_wallet_pwd),
pljson_varray('code',
'data[*].code',
'data[*].name',
'data[*].parent',
'data[*].enable_flag',
'data[*].los_date'),
pljson_varray('status_code',
'budget_dept_code',
'budget_dept_name',
'parent_code',
'enable_flag',
'end_active_date'),
table_mode => 'nested')) json
ORDER BY 2;
如果是要消费的是https接口,则需要配置oracle钱包导入证书,这里也支持带参数的接口,可以把参数放到where条件中,具体可以参考apex_web_service.make_rest_request的用法
这样就实现了像写sql一样来访问webservice数据
边栏推荐
- Gartner Hype Cycle:超融合技术将在2年内到达“生产力成熟期”
- [FreeRTOS] FreeRTOS and stm32 built-in stack occupancy
- Memory Forensics Series 1
- 深度学习训练前快速批量修改数据集中的图片名
- 2022 Nioke Multi-School Training Session H Question H Take the Elevator
- Use of pytorch: Convolutional Neural Network Module
- Opencv - video frame skipping processing
- 如何用 Solidity 创建一个“Hello World”智能合约
- 执掌图表
- 方法重写与Object类
猜你喜欢
随机推荐
Jin Jiu Yin Shi Interview and Job-hopping Season; Are You Ready?
Pytorch usage and tricks
(十七)51单片机——AD/DA转换
Software testing interview questions: Have you used some tools for software defect (Bug) management in your past software testing work? If so, please describe the process of software defect (Bug) trac
C# const readonly static 关键字区别
Opencv——视频跳帧处理
The principle of NMS and its code realization
【FreeRTOS】FreeRTOS与stm32内置堆栈的占用情况
matlab 采用描点法进行数据模拟和仿真
4. PCIe interface timing
GCC:屏蔽动态库之间的依赖
迅睿cms网站搬迁换了服务器后网站不能正常显示
Are testing jobs so hard to find?I am 32 this year and I have been unemployed for 2 months. What should an older test engineer do next to support his family?
主库预警日志报错ORA-00270
CNI(Container Network Plugin)
2022杭电多校第一场
ora-00604 ora-02429
MongoDB construction and basic operations
4. PCIe 接口时序
蓝牙Mesh系统开发五 ble mesh设备增加与移除









