当前位置:网站首页>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数据
边栏推荐
- 【七夕如何根据情侣倾听的音乐进行薅羊毛】背景音乐是否会影响情侣对酒的选择
- Software testing interview questions: How many types of software are there?
- 动态规划/背包问题总结/小结——01背包、完全背包
- LiveVideoStackCon 2022 Shanghai Station opens tomorrow!
- EL定时刷新页面中的皕杰报表实例
- Dynamic Programming/Knapsack Problem Summary/Summary - 01 Knapsack, Complete Knapsack
- After the staged testing is complete, have you performed defect analysis?
- 硬实力和软实力,哪个对测试人来说更重要?
- 第十四天&postman
- 2022 Hangzhou Electric Power Multi-School Session 3 K Question Taxi
猜你喜欢
随机推荐
2022 Nioke Multi-School Training Session H Question H Take the Elevator
软件基础的理论
(17) 51 MCU - AD/DA conversion
Interview summary: Why do interviewers in large factories always ask about the underlying principles of Framework?
接口自动化测试框架postman tests常用方法
2022 Hangzhou Electric Power Multi-School Session 3 K Question Taxi
主库预警日志报错ORA-00270
【七夕如何根据情侣倾听的音乐进行薅羊毛】背景音乐是否会影响情侣对酒的选择
阶段性测试完成后,你进行缺陷分析了么?
自定义线程池
数仓4.0(三)------数据仓库系统
配置类总结
2021年11月网络规划设计师上午题知识点(下)
工具类总结
How DHCP works
从一次数据库误操作开始了解MySQL日志【bin log、redo log、undo log】
C# const readonly static 关键字区别
Software testing interview questions: Please draw the seven-layer network structure diagram of OSI and the four-layer structure diagram of TCP/IP?
【翻译】CNCF对OpenTracing项目的存档
Object.defineProperty实时监听数据变化并更新页面

![[Machine Learning] 21-day Challenge Study Notes (2)](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)







