New feature introduced in Oracle 21c sql*plus client is formatting the output of JSON type columns.
Starting with Oracle 21c, JSON is the newly introduced datatype for handling JSON data in SQL and PL/SQL programming.
The default is “normal” which clears the proper alignment and spacing.
jsonprint NORMAL
demo@PDB1> select json_arrayagg( json_object(*) returning json ) from dept;
--------------------------------------------------------------------------------
[{"DEPTNO":10,"DNAME":"ACCOUNTING","LOC":"NEW YORK"},{"DEPTNO":20,"DNAME":"RESEA
RCH","LOC":"DALLAS"},{"DEPTNO":30,"DNAME":"SALES","LOC":"CHICAGO"},{"DEPTNO":40,
"DNAME":"OPERATIONS","LOC":"BOSTON"}]
demo@PDB1> show jsonprint
jsonprint PRETTY
demo@PDB1> select json_arrayagg( json_object(*) returning json ) from dept;
--------------------------------------------------------------------------------
[
{
"DEPTNO" : 10,
"DNAME" : "ACCOUNTING",
"LOC" : "NEW YORK"
},
{
"DEPTNO" : 20,
"DNAME" : "RESEARCH",
"LOC" : "DALLAS"
},
{
"DEPTNO" : 30,
"DNAME" : "SALES",
"LOC" : "CHICAGO"
},
{
"DEPTNO" : 40,
"DNAME" : "OPERATIONS",
"LOC" : "BOSTON"
}
]
No comments:
Post a Comment