当前位置:网站首页>Combination of Oracle and JSON
Combination of Oracle and JSON
2022-07-01 10:51:00 【bisal(Chen Liu)】
A lot of people JSON No stranger ,JSON(JavaScript Object Notation) Is a lightweight data exchange format , He was based on ECMAScript(European Computer Manufacturers Association, Developed by the European Computer Association js standard ) A subset of , Use text format completely independent of programming language to store and represent data . A simple and clear hierarchy makes JSON Become the ideal data exchange language . Easy to read and write , At the same time, it is also easy for machine analysis and generation , And effectively improve the network transmission efficiency .
In short ,JSON Is a syntax for storing and exchanging data .JSON The essence is string ,JSON Data is used in language , Whether it's Java、C#, still js, You can use JSON.
JSON Is a set of key value pairs of data objects , stay JavaScript It's inside JavaScript The object of , stay Java The middle is Java Of JSON object ( class /VO).JSON Write the data as the name / It's worth it , name / The value consists of the field name , Followed by a colon and a value , General format , As shown below ,
name={name01:“test1”,name02={ name02:“test2”,name021:“test3”} } stay JSON in , The value must be one of the following data types ,
character string
Numbers
object (JSON object )
Array
Boolean
Null
JSON The value of cannot be one of the following data types ,
function
date
undefined
Friends with development experience may have used it before XML As a format for data transmission , Here is a XML Examples of data formats ,

This is the use of JSON Show examples of the same data ,

You can see ,JSON Simple grammar format and clear hierarchy are obviously better than XML Easy to read , And in terms of data exchange , because JSON The characters used are more than XML much less , It can greatly save the bandwidth occupied by data transmission , Transmission efficiency , Will be higher than XML.
Oracle from 12c Support from the beginning JSON Storage and retrieval of , Relevant functions have been enhanced in each version , For example, some JSON The limitation of , The allowed length and other features will be improved , for example 12c Description of ,JSON search index Support 64 byte ,
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/adjsn/oracle-json-restrictions.html#GUID-1DB81125-54A7-4CB6-864B-78E0E7E407C9

19c Description of ,JSON search index Has been able to support 255 byte ,
https://docs.oracle.com/en/database/oracle/oracle-database/19/adjsn/oracle-json-restrictions.html#GUID-1DB81125-54A7-4CB6-864B-78E0E7E407C9

So when we use these features , We need to pay attention to the support differences of different versions .
Oracle We can use json_object() Function to convert the search result into JSON, As shown below ,

You can also customize it key,

You can store the search results as a list ,

It also supports sorting ,

Use only json_object(), Each record is a separate json, If you want to generate one for all records json, Can combine json_arrayagg Together with , As shown below ,

But this error is likely to occur , There are many returned record data , Prompt maximum 4000,

This is because json_arrayagg() There are two types of returns ,varchar2 and clob, If you don't explicitly specify , It's used varchar2, If the limit is exceeded , You can use clob type , More content will be output ,
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_ARRAYAGG.html#GUID-6D56077D-78DE-4CC0-9498-225DDC42E054

increase returning clob Clause , You can show ,

and JSON There are many related functions , If you need to know ,

For some basic JSON Operational requirements ,Oracle It can still be satisfied , This avoids going through procedures or SQL Splicing JSON The operation of , In terms of convenience , There is some help .
Reference material ,
https://baike.baidu.com/item/JSON/2462549?fr=aladdin
https://blog.csdn.net/weixin_44600235/article/details/107630279
Recently updated articles :
《 How to " grace " avoid MySQL Login tips 》
《 Xiaobai studies MySQL - Incremental Statistics SQL The needs of - Scheme of windowed function 》
《 List of domestic databases 》
《 Xiaobai studies MySQL - The statistical " Be opportunistic "》
《 Xiaobai studies MySQL - Incremental Statistics SQL The needs of 》
Recent hot articles :
《" Red Alert " Game open source code brings us a shock 》
Article classification and indexing :
边栏推荐
- 大佬们,数据湖iceberg的数据,怎样导出到mysql? 有什么工具? sqoop,datax都没
- 推荐一款 JSON 可视化工具神器!
- flutter Uint8List格式的图片和File格式图片的互相转换
- [.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B
- How does MySQL copy table data from one database to another (two databases are not linked to the same database)
- How do clients request databases?
- [MPC] ① quadratic programming problem matlab solver quadprog
- Crawler (2) - requests (1) | deep parsing of requests module
- LeetCode 438. Find all letter ectopic words in the string__ sliding window
- dotnet 控制台 使用 Microsoft.Maui.Graphics 配合 Skia 进行绘图入门
猜你喜欢
![[.net6] use ml.net+onnx pre training model to liven the classic](/img/b3/b117481fba7257453011e4cdb1eaaa.png)
[.net6] use ml.net+onnx pre training model to liven the classic "Huaqiang buys melons" in station B

What are the advantages and disadvantages of PHP

Wireshark TS | confusion between fast retransmission and out of sequence

CRC 校驗

What legal risks and qualifications should be paid attention to when building a digital collection platform?

移动硬盘驱动器读到,但不显示盘符

12款大家都在用的產品管理平臺

CRC check

中国探月工程独家藏品限量发售!

建议收藏 | 在openGauss上遇到慢SQL该怎么办?
随机推荐
[dark horse morning post] Yu Minhong said he never looked at the stock price of New Oriental; Hengchi 5 will start pre-sale in July; Naixue virtual stock or suspected of illegal fund-raising; From Jul
dotnet 控制台 使用 Microsoft.Maui.Graphics 配合 Skia 进行绘图入门
CCNP Part XII BGP (IV)
How does MySQL copy table data from one database to another (two databases are not linked to the same database)
Is the securities account opened by Yixue school for individuals safe? Is there a routine
谷歌新论文-Minerva:用语言模型解决定量推理问题
Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
LeetCode 438. Find all letter ectopic words in the string__ sliding window
Crawler (2) - requests (1) | deep parsing of requests module
Database experiment report (II)
Mutual conversion of pictures in fluent uint8list format and pictures in file format
内存泄漏定位工具之 valgrind 使用
In the new database era, don't just learn Oracle and MySQL
云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
选择在中金证券上炒股开户可以吗?安全吗?
想请教一下,我在广州,到哪里开户比较好?现在网上开户安全么?
大佬们,数据湖iceberg的数据,怎样导出到mysql? 有什么工具? sqoop,datax都没
Can I choose to open an account on CICC securities? Is it safe?
Does anyone know why? The table structure is the source table MySQL CDC that has just been directly copied
Can MySQL CDC take out the op field