当前位置:网站首页>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数据
边栏推荐
- 方法重写与Object类
- ORA-01105 ORA-03175
- DHCP的工作过程
- 蓝牙Mesh系统开发五 ble mesh设备增加与移除
- sqlite--nested exception is org.apache.ibatis.exceptions.PersistenceException:
- Getting Started with Kubernetes Networking
- oracle create tablespace
- linux(centOs7)部署mysql(8.0.20)数据库
- 金仓数据库 KingbaseES V8 GIS数据迁移方案(3. 基于ArcGIS平台的数据迁移到KES)
- VOC格式数据集转COCO格式数据集
猜你喜欢

VOC格式数据集转COCO格式数据集

从一次数据库误操作开始了解MySQL日志【bin log、redo log、undo log】

Activity Recommendation | Kuaishou StreamLake Brand Launch Conference, witness together on August 10!

5. PCIe official example

4. PCIe 接口时序

【Redis】Linux下Redis安装

Theory of Software Fundamentals

动态规划/背包问题总结/小结——01背包、完全背包

【Endnote】Word插入自定义形式的Endnote文献格式

Inter-process communication and inter-thread communication
随机推荐
Difference between MBps and Mbps
Opencv——视频跳帧处理
Software Testing Interview Questions: What is Software Testing?The purpose and principle of software testing?
ORA-00604 ORA-02429
[How to smash wool according to the music the couple listens to during the Qixi Festival] Does the background music affect the couple's choice of wine?
【Word】Word公式导出PDF后出现井号括号#()错误
Lattice PCIe Learning 1
Software testing interview questions: the difference and connection between black box testing, white box testing, and unit testing, integration testing, system testing, and acceptance testing?
torch.autograd.grad finds the second derivative
3. pcie.v file
GCC:屏蔽动态库之间的依赖
GCC: Shield dependencies between dynamic libraries
超越YOLO5-Face | YOLO-FaceV2正式开源Trick+学术点拉满
张驰咨询:揭晓六西格玛管理(6 Sigma)长盛不衰的秘密
sqlite--nested exception is org.apache.ibatis.exceptions.PersistenceException:
10年测试经验,在35岁的生理年龄面前,一文不值
Software Testing Interview Questions: What do test cases usually include?
软件基础的理论
day14--postman接口测试
Bit rate vs. resolution, which one is more important?