SlideShare a Scribd company logo
Going Native:
Leveraging the New
JSON Native Datatype
in Oracle 21c
Jim Czuprynski
@JimTheWhyGuy
Zero Defect Computing, Inc.
Who Am I, and What Am I Doing Here?
➢E-mail me at jim@jimthewhyguy.com
➢Follow me on Twitter (@JimTheWhyGuy)
➢Connect with me on LinkedIn (Jim Czuprynski)
Traveler & public speaker Summers:
Wisconsin
Winters:
Illinois
Cyclist
XC skier
Avid
amateur
bird
watcher
Oldest dude in
martial arts class
Jim Czuprynski
Liron Amitzi
https://www.beyondtechskills.com
The podcast that talks about everything tech – except tech.TM
Converged Database: A Vision for the Future, 21c and Beyond
Personal /
External
Datasets
Enterprise Applications
Data Integration
OAC, OML,
APEX, and
Graph Studio
Ad hoc,
Batch or
Scheduled
Business
Leaders
Analysts
Data
Scientists
Developers
OAC Dataflow,
Manual or ETL
Data Management
ADW
Business Analytics
ERP CRM HCM
Self-sufficient,
encrypted, secured
data storehouse
Self-service
analytics via ML
REST-Enabled
External APIs
IoT and
Edge
Computing
ATP
AJD AGD
Autonomous JSON Database
emerges as serious
contender versus MongoDB
Autonomous Database for
Graph Studio enables
analysis & visualization of
complex relationships
AutoML features make it simple
to apply the right algorithm(s)
with confidence
JSON Document Formatting and Components: A Refresher
{"type" : "FeatureCollection"
,"features" : [
{"type" : "Feature"
,"geometry" :
{"type" : "Point“
, "coordinates" : [-89.3106, 43.0653]
}
, "properties" : {
"Name" : "Blains Farm & Fleet"
, "Address" : "2202 SOUTH STOUGHTON ROAD"
, "City" : "MADISON”
, "State" : "WI"
, "ZIPCode" : "53716“
}
, "chargertypes": ["L2","L3"]
}
]
}
JSON
Document
(aka Object)
String : Value
pairs
GeoJSON
Array
Multiple String :
Value Pairs
Multiple Values in an Array
(~ a repeating group)
New in 21c: A Native JSON Datatype
CREATE TABLE bart.t_geojson(
gis_id NUMBER(06) NOT NULL
,gis_doc JSON
)
TABLESPACE json_data
STORAGE (INITIAL 8M NEXT 8M);
Here’s how simple it is
to designate the new
native JSON datatype
CREATE TABLE bart.t_notnative(
gis_id NUMBER(06) NOT NULL
,gis_doc BLOB
CONSTRAINT ensure_json
CHECK (gis_doc IS JSON)
)
LOB (gis_doc)
STORE AS (CACHE)
TABLESPACE json_data
STORAGE (INITIAL 8M NEXT 8M);
Compare it to this complex (but still-
valid!) syntax to create suitable
JSON storage in prior releases
Loading JSON Has Never Been This Easy
CREATE DIRECTORY XTJSON
AS '/u01/app/oracle/homes/OraDB21000_home1/XTFILES';
CREATE TABLE bart.xt_gis_docs(
gis_id VARCHAR2(06)
,gis_doc VARCHAR2(4000)
)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY XTJSON
ACCESS PARAMETERS (FIELDS TERMINATED BY '|')
LOCATION ('SampleGeoJSON.csv')
)
REJECT LIMIT 50000;
First, build an EXTERNAL
table referencing the
input file …
Loading JSON Has Never Been This Easy
CREATE DIRECTORY XTJSON
AS '/u01/app/oracle/homes/OraDB21000_home1/XTFILES';
CREATE TABLE bart.xt_gis_docs(
gis_id VARCHAR2(06)
,gis_doc VARCHAR2(4000)
)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY XTJSON
ACCESS PARAMETERS (FIELDS TERMINATED BY '|')
LOCATION ('SampleGeoJSON.csv')
)
REJECT LIMIT 50000;
First, build an EXTERNAL
table referencing the
input file …
TRUNCATE TABLE bart.t_geojson;
INSERT INTO bart.t_geojson(gis_id, gis_doc)
SELECT gis_id, gis_doc from bart.xt_gis_docs;
COMMIT;
… and then load the target
table via the standard INSERT
INTO … SELECT FROM method
Of course, loading via utilities like SQL*Loader is also fully supported!
Using New APEX Loading Capabilities for JSON Data Sources
New APEX loading
methods make
short work of
loading JSON
content
Using New APEX Loading Capabilities for JSON Data Sources
New APEX loading
methods make
short work of
loading JSON
content
Note the 21c Native JSON
column datatype is
automatically recognized
Feel the Need? The Need For Speed? 21c’s JSON Datatype is the Answer.
The new native JSON datatype is transferred between Oracle 21c client sessions and
the 21c database server without any textual conversion
• JSON encoding on ingest and text serialization on output are thus avoided
• This dramatically improves performance because it saves database CPU
The latest 21c client drivers are required to take advantage of these features!
• Otherwise, JSON datatype instances must first be converted to JSON text, which can dramatically
reduce the binary efficiencies of the JSON Native datatype
• The new 21c client are also capable of directly processing the binary JSON format (OSON) to
directly support JSON APIs
• The latest 21c client also supports the use of extended types
Note: SODA default collections built within an Oracle Database 21c must still use the 21c SODA
driver to leverage the native JSON type
Download the latest Oracle 21c Client drivers here
A New JSON Multi-Tool: JSON_TRANSFORM()
Check out a complete description of JSON_TRANSFORM() capabilities here
JSON_TRANSFORM()
Verb
Resulting Capability
INSERT Insert value of specified SQL expression at location targeted by specified path expression
APPEND Add value of specified SQL expression to targeted array
RENAME Rename field targeted by specified path expression to value of SQL expression
SET UPSERT data targeted by specified path expression to value of specified SQL expression
REPLACE Replace data defined by specified path expression with value of specified SQL expression
KEEP Remove all parts of input data not targeted by at least one of the specified path expressions
REMOVE Remove input data targeted by specified path expression
Updating JSON Key Values Directly With JSON_TRANSFORM
This statement will fix
Name values, but only
for selected entries
This UPSERT operation
didn’t require creating a
new copy of each JSON
document and then
essentially re-inserting the
updated document
JSON_TRANSFORM(): Some Other Examples
UPDATE bart.t_geojson
SET gi_doc =
JSON_TRANSFORM(gi_doc, SET '$.LastChangedOn' = SYSTIMESTAMP);
Add and populate a new column (LastChangedOn) to all JSON documents:
1
UPDATE bart.t_geojson
SET gis_doc =
JSON_TRANSFORM(gis_doc, APPEND '$.features.chargertypes' = 'Mr. Fusion');
Add a new element at the start of a specific JSON array:
2
UPDATE bart.t_geojson
SET gis_doc =
JSON_TRANSFORM(gis_doc, REMOVE '$.features.chargertypes');
Remove an existing element from an existing field for all JSON documents:
3
Differences between Native JSON vs. JSON_SCALAR() SQL Function
SELECT
JSON_VALUE(
JSON_SCALAR(CURRENT_TIMESTAMP), '$.timestamp()'
) AS "Extended TIMESTAMP"
FROM DUAL;
See this for a summary of Native JSON vs. JSON_SCALAR and JSON_SERIALIZE SQL functions
JSON_SCALAR() accepts
a SQL scalar value as
input and returns a
corresponding JSON
scalar value as a JSON
type instance
Extended TIMESTAMP
-------------------------------
12-JUN-22 04.50.04.138529000 PM
It therefore extends the
JSON native type for Oracle-
specific datatypes like DATE,
TIMESTAMP, and INTERVAL
YTM / DTS
Path Expression Item Methods With JSON_VALUE()
SELECT
gis_id
,JSON_VALUE(gis_doc,
'$.features.chargertypes[*].minString()’)
AS Lowest
,JSON_VALUE(gis_doc,
'$.features.chargertypes[*].maxString()’)
AS Highest
FROM bart.t_geojson;
Here’s an extensive list of the myriad conversion capabilities for JSON_VALUE()
JSON_VALUE() can
apply item methods
for data conversions
GIS_ID LOWEST HIGHEST
------ ---------- ----------
2714 L1 Mr. Fusion
2715 L1 Mr. Fusion
2716 L1 Mr. Fusion
2717 L1 Mr. Fusion
2718 L2 Mr. Fusion
. . .
In this example, it returns the minimum
and maximum string values within the
CHARGERTYPES item array
Multi-Value Functional Indexes: Benefits
{"type" : "FeatureCollection"
,"features" : [
{"type" : "Feature"
,"geometry" :
{"type" : "Point“
, "coordinates" : [-89.3106, 43.0653]
}
, "properties" : {
"Name" : "Blains Farm & Fleet"
, "Address" : "2202 SOUTH STOUGHTON ROAD"
, "City" : "MADISON”
, "State" : "WI"
, "ZIPCode" : "53716“
}
, "chargertypes": ["L2","L3"]
}
]
}
This CHARGERTYPES
JSON array may store
multiple different
values …
… but what if our query needs to
find only charging locations
offering L3 chargers?
Multi-Value Functional Indexes: Implementation
DROP INDEX bart.chargertypes_fk_idx;
CREATE MULTIVALUE INDEX bart.chargertypes_fk_idx
ON bart.t_geojson t
(t.gis_doc.features.chargertypes[*].string());
Not a problem in 21c! We can create a multi-value
index for that JSON array’s values
Note that various JSON datatype
expressions are supported as well
Multi-Value Indexes: Proof of Usage
SELECT
gis_id AS id
,TI.gis_doc.features.properties.City AS city
FROM bart.t_geojson TI
WHERE JSON_EXISTS(gis_doc,
'$.features.chargertypes[*]?(@.string() == "L3")');
Here’s a simple query to test
usage of the multi-value index
on values stored within the
CHARGERTYPES JSON array
Multi-Value Indexes: Proof of Usage
SELECT
gis_id AS id
,TI.gis_doc.features.properties.City AS city
FROM bart.t_geojson TI
WHERE JSON_EXISTS(gis_doc,
'$.features.chargertypes[*]?(@.string() == "L3")');
Here’s a simple query to test
usage of the multi-value index
on values stored within the
CHARGERTYPES JSON array
The RANGE SCAN (MULTI VALUE)
operation indicates the multi-value index
on CHARGERTYPES was definitely used
Storing, Indexing, and Using GeoJSON GIS Data
{"type" : "FeatureCollection"
,"features" : [
{"type" : "Feature"
,"geometry" :
{"type" : "Point“
, "coordinates" : [-89.3106, 43.0653]
}
, "properties" : {
"Name" : "Blains Farm & Fleet"
, "Address" : "2202 SOUTH STOUGHTON ROAD"
, "City" : "MADISON”
, "State" : "WI"
, "ZIPCode" : "53716“
}
, "chargertypes": ["L2","L3"]
}
]
}
This GEOMETRY JSON object contains a
GeoJSON longitude / latitude pair
Storing, Indexing, and Using GeoJSON GIS Data
{"type" : "FeatureCollection"
,"features" : [
{"type" : "Feature"
,"geometry" :
{"type" : "Point“
, "coordinates" : [-89.3106, 43.0653]
}
, "properties" : {
"Name" : "Blains Farm & Fleet"
, "Address" : "2202 SOUTH STOUGHTON ROAD"
, "City" : "MADISON”
, "State" : "WI"
, "ZIPCode" : "53716“
}
, "chargertypes": ["L2","L3"]
}
]
}
This GEOMETRY JSON object contains a
GeoJSON longitude / latitude pair
SELECT
JSON_VALUE(gis_doc, '$.features[0].geometry'
RETURNING SDO_GEOMETRY
ERROR ON ERROR) AS SDOGeometryObject
,TI.gis_doc.features.properties[0].City AS City
,TI.gis_doc.features.properties[0].ZIPCode AS "ZIP Code"
FROM bart.t_geojson TI;
21c lets us translate them
directly into an
SDO_GEOMETRY object for use
in mapping and geolocation
Building a New APEX App Using GeoJSON Data (1)
We’ll create a new APEX app …
1
Building a New APEX App Using GeoJSON Data (1)
We’ll create a new APEX app …
1
… from either an existing
template, or downloaded code
2
Building a New APEX App Using GeoJSON Data (2)
We’ll build the new app
from scratch …
3
… and name it appropriately
4
Building a New APEX App Using GeoJSON Data (3)
Next, we’ll add a page using the new
APEX 21.2 Native Map Region …
5
… to demonstrate GeoJSON
mapping capabilities
6
Building a New APEX App Using GeoJSON Data (4)
Here’s the resulting
APEX Native Map
Region, populated with
Longitude & Latitude
coordinates …
8
Building a New APEX App Using GeoJSON Data (4)
Here’s the resulting
APEX Native Map
Region, populated with
Longitude & Latitude
coordinates …
8
… and an Interactive Report
region with other data elements
relevant to each plotted location
9
Oh … One More Thing.
Document Databases are great, but ...
MongoDB has popularized document databases for developers with their free
to use community edition. MongoDB offers simple document database APIs;
however, it has limitations supporting multi-document ACID transactions
critical to enterprise applications. For developers, implementing basic SQL
engine functionality requires writing, testing and maintaining hundreds of
lines of application code, resulting in security vulnerabilities, increased
development time and maintenance.
- October 26, 2021: Kiran Makarla & Beda Hammerschmidt,
Oracle Database API for MongoDB with Oracle Autonomous Database
opens up an entirely new set of use cases for MongoDB applications
So, Your Data Is In MongoDB. And Your Point Is?
Establish security permissions
to access data within your
MongoDB database …
1
… create collections
and data within
MongoDB …
2
… and start accessing your
MongoDB data directly
from Oracle!
3
JSON: References and Further Reading
JSON DataType Support in Oracle 21c:
https://blogs.oracle.com/database/post/json-datatype-support-in-oracle-21c
Storing, Indexing, and Using GeoJSON Geographic Data:
https://docs.oracle.com/en/database/oracle/oracle-database/21/adjsn/using-GeoJSON-geographic-data.html
Autonomous JSON Database (AJD) and SODA Examples:
https://www.slideshare.net/jczuprynski/json-a-splash-of-soda-and-a-sql-chaser-realworld-use-cases-for-autonomous-json-database-ajd
OSON - A Deeper Look:
https://blogs.oracle.com/jsondb/osonformat
http://www.vldb.org/pvldb/vol13/p3059-liu.pdf

More Related Content

Similar to Going Native: Leveraging the New JSON Native Datatype in Oracle 21c

2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
antoinegirbal
 
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_103 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
mlraviol
 
JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...
JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...
JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...
Jim Czuprynski
 
Agile Database Development with JSON
Agile Database Development with JSONAgile Database Development with JSON
Agile Database Development with JSON
Chris Saxon
 
JSON Support in DB2 for z/OS
JSON Support in DB2 for z/OSJSON Support in DB2 for z/OS
JSON Support in DB2 for z/OS
Jane Man
 
Native JSON Support in SQL2016
Native JSON Support in SQL2016Native JSON Support in SQL2016
Native JSON Support in SQL2016
Ivo Andreev
 
Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018
Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018
Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018
Alexander Tokarev
 
Data Types/Structures in DivConq
Data Types/Structures in DivConqData Types/Structures in DivConq
Data Types/Structures in DivConq
eTimeline, LLC
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
Maria Colgan
 
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
Altinity Ltd
 
PostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and OperatorsPostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and Operators
Nicholas Kiraly
 
What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2
MariaDB plc
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commandsleminhvuong
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commandsphanleson
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
stewashton
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
Tatu Saloranta
 
JPA 2.0
JPA 2.0JPA 2.0
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developers
Keshav Murthy
 
Programming the Physical World with Device Shadows and Rules Engine
Programming the Physical World with Device Shadows and Rules EngineProgramming the Physical World with Device Shadows and Rules Engine
Programming the Physical World with Device Shadows and Rules Engine
Amazon Web Services
 

Similar to Going Native: Leveraging the New JSON Native Datatype in Oracle 21c (20)

2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
 
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_103 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
 
JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...
JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...
JSON, A Splash of SODA, and a SQL Chaser: Real-World Use Cases for Autonomous...
 
Agile Database Development with JSON
Agile Database Development with JSONAgile Database Development with JSON
Agile Database Development with JSON
 
JSON Support in DB2 for z/OS
JSON Support in DB2 for z/OSJSON Support in DB2 for z/OS
JSON Support in DB2 for z/OS
 
Native JSON Support in SQL2016
Native JSON Support in SQL2016Native JSON Support in SQL2016
Native JSON Support in SQL2016
 
Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018
Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018
Oracle JSON treatment evolution - from 12.1 to 18 AOUG-2018
 
Data Types/Structures in DivConq
Data Types/Structures in DivConqData Types/Structures in DivConq
Data Types/Structures in DivConq
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
 
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
All About JSON and ClickHouse - Tips, Tricks and New Features-2022-07-26-FINA...
 
PostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and OperatorsPostgreSQL 9.4 JSON Types and Operators
PostgreSQL 9.4 JSON Types and Operators
 
What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2What’s New in MariaDB Server 10.2
What’s New in MariaDB Server 10.2
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
 
JPA 2.0
JPA 2.0JPA 2.0
JPA 2.0
 
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developers
 
Programming the Physical World with Device Shadows and Rules Engine
Programming the Physical World with Device Shadows and Rules EngineProgramming the Physical World with Device Shadows and Rules Engine
Programming the Physical World with Device Shadows and Rules Engine
 
dfl
dfldfl
dfl
 

More from Jim Czuprynski

From DBA to DE: Becoming a Data Engineer
From DBA to DE:  Becoming a Data Engineer From DBA to DE:  Becoming a Data Engineer
From DBA to DE: Becoming a Data Engineer
Jim Czuprynski
 
Access Denied: Real-World Use Cases for APEX and Real Application Security
Access Denied: Real-World Use Cases for APEX and Real Application SecurityAccess Denied: Real-World Use Cases for APEX and Real Application Security
Access Denied: Real-World Use Cases for APEX and Real Application Security
Jim Czuprynski
 
Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...
Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...
Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...
Jim Czuprynski
 
Graphing Grifters: Identify & Display Patterns of Corruption With Oracle Graph
Graphing Grifters: Identify & Display Patterns of Corruption With Oracle GraphGraphing Grifters: Identify & Display Patterns of Corruption With Oracle Graph
Graphing Grifters: Identify & Display Patterns of Corruption With Oracle Graph
Jim Czuprynski
 
So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...
So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...
So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...
Jim Czuprynski
 
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Jim Czuprynski
 
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Jim Czuprynski
 
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Jim Czuprynski
 
What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.
What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.
What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.
Jim Czuprynski
 
An Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAs
An Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAsAn Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAs
An Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAs
Jim Czuprynski
 
Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...
Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...
Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...
Jim Czuprynski
 
One Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingOne Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic Indexing
Jim Czuprynski
 
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Jim Czuprynski
 
Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...
Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...
Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...
Jim Czuprynski
 
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEXWhere the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Jim Czuprynski
 
Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...
Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...
Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...
Jim Czuprynski
 

More from Jim Czuprynski (16)

From DBA to DE: Becoming a Data Engineer
From DBA to DE:  Becoming a Data Engineer From DBA to DE:  Becoming a Data Engineer
From DBA to DE: Becoming a Data Engineer
 
Access Denied: Real-World Use Cases for APEX and Real Application Security
Access Denied: Real-World Use Cases for APEX and Real Application SecurityAccess Denied: Real-World Use Cases for APEX and Real Application Security
Access Denied: Real-World Use Cases for APEX and Real Application Security
 
Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...
Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...
Charge Me Up! Using Oracle ML, Analytics, and APEX For Finding Optimal Charge...
 
Graphing Grifters: Identify & Display Patterns of Corruption With Oracle Graph
Graphing Grifters: Identify & Display Patterns of Corruption With Oracle GraphGraphing Grifters: Identify & Display Patterns of Corruption With Oracle Graph
Graphing Grifters: Identify & Display Patterns of Corruption With Oracle Graph
 
So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...
So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...
So an Airline Pilot, a Urologist, and an IT Technologist Walk Into a Bar: Thi...
 
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
 
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
 
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
 
What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.
What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.
What's Your Super-Power? Mine is Machine Learning with Oracle Autonomous DB.
 
An Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAs
An Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAsAn Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAs
An Autonomous Singularity Approaches: Force Multipliers For Overwhelmed DBAs
 
Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...
Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...
Politics Ain’t Beanbag: Using APEX, ML, and GeoCoding In a Modern Election Ca...
 
One Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingOne Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic Indexing
 
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
 
Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...
Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...
Cluster, Classify, Associate, Regress: Satisfy Your Inner Data Scientist with...
 
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEXWhere the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
Where the %$#^ Is Everybody? Geospatial Solutions For Oracle APEX
 
Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...
Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...
Fast and Furious: Handling Edge Computing Data With Oracle 19c Fast Ingest an...
 

Recently uploaded

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 

Recently uploaded (20)

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 

Going Native: Leveraging the New JSON Native Datatype in Oracle 21c

  • 1. Going Native: Leveraging the New JSON Native Datatype in Oracle 21c Jim Czuprynski @JimTheWhyGuy Zero Defect Computing, Inc.
  • 2. Who Am I, and What Am I Doing Here? ➢E-mail me at jim@jimthewhyguy.com ➢Follow me on Twitter (@JimTheWhyGuy) ➢Connect with me on LinkedIn (Jim Czuprynski) Traveler & public speaker Summers: Wisconsin Winters: Illinois Cyclist XC skier Avid amateur bird watcher Oldest dude in martial arts class
  • 3. Jim Czuprynski Liron Amitzi https://www.beyondtechskills.com The podcast that talks about everything tech – except tech.TM
  • 4. Converged Database: A Vision for the Future, 21c and Beyond Personal / External Datasets Enterprise Applications Data Integration OAC, OML, APEX, and Graph Studio Ad hoc, Batch or Scheduled Business Leaders Analysts Data Scientists Developers OAC Dataflow, Manual or ETL Data Management ADW Business Analytics ERP CRM HCM Self-sufficient, encrypted, secured data storehouse Self-service analytics via ML REST-Enabled External APIs IoT and Edge Computing ATP AJD AGD Autonomous JSON Database emerges as serious contender versus MongoDB Autonomous Database for Graph Studio enables analysis & visualization of complex relationships AutoML features make it simple to apply the right algorithm(s) with confidence
  • 5. JSON Document Formatting and Components: A Refresher {"type" : "FeatureCollection" ,"features" : [ {"type" : "Feature" ,"geometry" : {"type" : "Point“ , "coordinates" : [-89.3106, 43.0653] } , "properties" : { "Name" : "Blains Farm & Fleet" , "Address" : "2202 SOUTH STOUGHTON ROAD" , "City" : "MADISON” , "State" : "WI" , "ZIPCode" : "53716“ } , "chargertypes": ["L2","L3"] } ] } JSON Document (aka Object) String : Value pairs GeoJSON Array Multiple String : Value Pairs Multiple Values in an Array (~ a repeating group)
  • 6. New in 21c: A Native JSON Datatype CREATE TABLE bart.t_geojson( gis_id NUMBER(06) NOT NULL ,gis_doc JSON ) TABLESPACE json_data STORAGE (INITIAL 8M NEXT 8M); Here’s how simple it is to designate the new native JSON datatype CREATE TABLE bart.t_notnative( gis_id NUMBER(06) NOT NULL ,gis_doc BLOB CONSTRAINT ensure_json CHECK (gis_doc IS JSON) ) LOB (gis_doc) STORE AS (CACHE) TABLESPACE json_data STORAGE (INITIAL 8M NEXT 8M); Compare it to this complex (but still- valid!) syntax to create suitable JSON storage in prior releases
  • 7. Loading JSON Has Never Been This Easy CREATE DIRECTORY XTJSON AS '/u01/app/oracle/homes/OraDB21000_home1/XTFILES'; CREATE TABLE bart.xt_gis_docs( gis_id VARCHAR2(06) ,gis_doc VARCHAR2(4000) ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY XTJSON ACCESS PARAMETERS (FIELDS TERMINATED BY '|') LOCATION ('SampleGeoJSON.csv') ) REJECT LIMIT 50000; First, build an EXTERNAL table referencing the input file …
  • 8. Loading JSON Has Never Been This Easy CREATE DIRECTORY XTJSON AS '/u01/app/oracle/homes/OraDB21000_home1/XTFILES'; CREATE TABLE bart.xt_gis_docs( gis_id VARCHAR2(06) ,gis_doc VARCHAR2(4000) ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY XTJSON ACCESS PARAMETERS (FIELDS TERMINATED BY '|') LOCATION ('SampleGeoJSON.csv') ) REJECT LIMIT 50000; First, build an EXTERNAL table referencing the input file … TRUNCATE TABLE bart.t_geojson; INSERT INTO bart.t_geojson(gis_id, gis_doc) SELECT gis_id, gis_doc from bart.xt_gis_docs; COMMIT; … and then load the target table via the standard INSERT INTO … SELECT FROM method Of course, loading via utilities like SQL*Loader is also fully supported!
  • 9. Using New APEX Loading Capabilities for JSON Data Sources New APEX loading methods make short work of loading JSON content
  • 10. Using New APEX Loading Capabilities for JSON Data Sources New APEX loading methods make short work of loading JSON content Note the 21c Native JSON column datatype is automatically recognized
  • 11. Feel the Need? The Need For Speed? 21c’s JSON Datatype is the Answer. The new native JSON datatype is transferred between Oracle 21c client sessions and the 21c database server without any textual conversion • JSON encoding on ingest and text serialization on output are thus avoided • This dramatically improves performance because it saves database CPU The latest 21c client drivers are required to take advantage of these features! • Otherwise, JSON datatype instances must first be converted to JSON text, which can dramatically reduce the binary efficiencies of the JSON Native datatype • The new 21c client are also capable of directly processing the binary JSON format (OSON) to directly support JSON APIs • The latest 21c client also supports the use of extended types Note: SODA default collections built within an Oracle Database 21c must still use the 21c SODA driver to leverage the native JSON type Download the latest Oracle 21c Client drivers here
  • 12. A New JSON Multi-Tool: JSON_TRANSFORM() Check out a complete description of JSON_TRANSFORM() capabilities here JSON_TRANSFORM() Verb Resulting Capability INSERT Insert value of specified SQL expression at location targeted by specified path expression APPEND Add value of specified SQL expression to targeted array RENAME Rename field targeted by specified path expression to value of SQL expression SET UPSERT data targeted by specified path expression to value of specified SQL expression REPLACE Replace data defined by specified path expression with value of specified SQL expression KEEP Remove all parts of input data not targeted by at least one of the specified path expressions REMOVE Remove input data targeted by specified path expression
  • 13. Updating JSON Key Values Directly With JSON_TRANSFORM This statement will fix Name values, but only for selected entries This UPSERT operation didn’t require creating a new copy of each JSON document and then essentially re-inserting the updated document
  • 14. JSON_TRANSFORM(): Some Other Examples UPDATE bart.t_geojson SET gi_doc = JSON_TRANSFORM(gi_doc, SET '$.LastChangedOn' = SYSTIMESTAMP); Add and populate a new column (LastChangedOn) to all JSON documents: 1 UPDATE bart.t_geojson SET gis_doc = JSON_TRANSFORM(gis_doc, APPEND '$.features.chargertypes' = 'Mr. Fusion'); Add a new element at the start of a specific JSON array: 2 UPDATE bart.t_geojson SET gis_doc = JSON_TRANSFORM(gis_doc, REMOVE '$.features.chargertypes'); Remove an existing element from an existing field for all JSON documents: 3
  • 15. Differences between Native JSON vs. JSON_SCALAR() SQL Function SELECT JSON_VALUE( JSON_SCALAR(CURRENT_TIMESTAMP), '$.timestamp()' ) AS "Extended TIMESTAMP" FROM DUAL; See this for a summary of Native JSON vs. JSON_SCALAR and JSON_SERIALIZE SQL functions JSON_SCALAR() accepts a SQL scalar value as input and returns a corresponding JSON scalar value as a JSON type instance Extended TIMESTAMP ------------------------------- 12-JUN-22 04.50.04.138529000 PM It therefore extends the JSON native type for Oracle- specific datatypes like DATE, TIMESTAMP, and INTERVAL YTM / DTS
  • 16. Path Expression Item Methods With JSON_VALUE() SELECT gis_id ,JSON_VALUE(gis_doc, '$.features.chargertypes[*].minString()’) AS Lowest ,JSON_VALUE(gis_doc, '$.features.chargertypes[*].maxString()’) AS Highest FROM bart.t_geojson; Here’s an extensive list of the myriad conversion capabilities for JSON_VALUE() JSON_VALUE() can apply item methods for data conversions GIS_ID LOWEST HIGHEST ------ ---------- ---------- 2714 L1 Mr. Fusion 2715 L1 Mr. Fusion 2716 L1 Mr. Fusion 2717 L1 Mr. Fusion 2718 L2 Mr. Fusion . . . In this example, it returns the minimum and maximum string values within the CHARGERTYPES item array
  • 17. Multi-Value Functional Indexes: Benefits {"type" : "FeatureCollection" ,"features" : [ {"type" : "Feature" ,"geometry" : {"type" : "Point“ , "coordinates" : [-89.3106, 43.0653] } , "properties" : { "Name" : "Blains Farm & Fleet" , "Address" : "2202 SOUTH STOUGHTON ROAD" , "City" : "MADISON” , "State" : "WI" , "ZIPCode" : "53716“ } , "chargertypes": ["L2","L3"] } ] } This CHARGERTYPES JSON array may store multiple different values … … but what if our query needs to find only charging locations offering L3 chargers?
  • 18. Multi-Value Functional Indexes: Implementation DROP INDEX bart.chargertypes_fk_idx; CREATE MULTIVALUE INDEX bart.chargertypes_fk_idx ON bart.t_geojson t (t.gis_doc.features.chargertypes[*].string()); Not a problem in 21c! We can create a multi-value index for that JSON array’s values Note that various JSON datatype expressions are supported as well
  • 19. Multi-Value Indexes: Proof of Usage SELECT gis_id AS id ,TI.gis_doc.features.properties.City AS city FROM bart.t_geojson TI WHERE JSON_EXISTS(gis_doc, '$.features.chargertypes[*]?(@.string() == "L3")'); Here’s a simple query to test usage of the multi-value index on values stored within the CHARGERTYPES JSON array
  • 20. Multi-Value Indexes: Proof of Usage SELECT gis_id AS id ,TI.gis_doc.features.properties.City AS city FROM bart.t_geojson TI WHERE JSON_EXISTS(gis_doc, '$.features.chargertypes[*]?(@.string() == "L3")'); Here’s a simple query to test usage of the multi-value index on values stored within the CHARGERTYPES JSON array The RANGE SCAN (MULTI VALUE) operation indicates the multi-value index on CHARGERTYPES was definitely used
  • 21. Storing, Indexing, and Using GeoJSON GIS Data {"type" : "FeatureCollection" ,"features" : [ {"type" : "Feature" ,"geometry" : {"type" : "Point“ , "coordinates" : [-89.3106, 43.0653] } , "properties" : { "Name" : "Blains Farm & Fleet" , "Address" : "2202 SOUTH STOUGHTON ROAD" , "City" : "MADISON” , "State" : "WI" , "ZIPCode" : "53716“ } , "chargertypes": ["L2","L3"] } ] } This GEOMETRY JSON object contains a GeoJSON longitude / latitude pair
  • 22. Storing, Indexing, and Using GeoJSON GIS Data {"type" : "FeatureCollection" ,"features" : [ {"type" : "Feature" ,"geometry" : {"type" : "Point“ , "coordinates" : [-89.3106, 43.0653] } , "properties" : { "Name" : "Blains Farm & Fleet" , "Address" : "2202 SOUTH STOUGHTON ROAD" , "City" : "MADISON” , "State" : "WI" , "ZIPCode" : "53716“ } , "chargertypes": ["L2","L3"] } ] } This GEOMETRY JSON object contains a GeoJSON longitude / latitude pair SELECT JSON_VALUE(gis_doc, '$.features[0].geometry' RETURNING SDO_GEOMETRY ERROR ON ERROR) AS SDOGeometryObject ,TI.gis_doc.features.properties[0].City AS City ,TI.gis_doc.features.properties[0].ZIPCode AS "ZIP Code" FROM bart.t_geojson TI; 21c lets us translate them directly into an SDO_GEOMETRY object for use in mapping and geolocation
  • 23. Building a New APEX App Using GeoJSON Data (1) We’ll create a new APEX app … 1
  • 24. Building a New APEX App Using GeoJSON Data (1) We’ll create a new APEX app … 1 … from either an existing template, or downloaded code 2
  • 25. Building a New APEX App Using GeoJSON Data (2) We’ll build the new app from scratch … 3 … and name it appropriately 4
  • 26. Building a New APEX App Using GeoJSON Data (3) Next, we’ll add a page using the new APEX 21.2 Native Map Region … 5 … to demonstrate GeoJSON mapping capabilities 6
  • 27. Building a New APEX App Using GeoJSON Data (4) Here’s the resulting APEX Native Map Region, populated with Longitude & Latitude coordinates … 8
  • 28. Building a New APEX App Using GeoJSON Data (4) Here’s the resulting APEX Native Map Region, populated with Longitude & Latitude coordinates … 8 … and an Interactive Report region with other data elements relevant to each plotted location 9
  • 29. Oh … One More Thing. Document Databases are great, but ... MongoDB has popularized document databases for developers with their free to use community edition. MongoDB offers simple document database APIs; however, it has limitations supporting multi-document ACID transactions critical to enterprise applications. For developers, implementing basic SQL engine functionality requires writing, testing and maintaining hundreds of lines of application code, resulting in security vulnerabilities, increased development time and maintenance. - October 26, 2021: Kiran Makarla & Beda Hammerschmidt, Oracle Database API for MongoDB with Oracle Autonomous Database opens up an entirely new set of use cases for MongoDB applications
  • 30. So, Your Data Is In MongoDB. And Your Point Is? Establish security permissions to access data within your MongoDB database … 1 … create collections and data within MongoDB … 2 … and start accessing your MongoDB data directly from Oracle! 3
  • 31. JSON: References and Further Reading JSON DataType Support in Oracle 21c: https://blogs.oracle.com/database/post/json-datatype-support-in-oracle-21c Storing, Indexing, and Using GeoJSON Geographic Data: https://docs.oracle.com/en/database/oracle/oracle-database/21/adjsn/using-GeoJSON-geographic-data.html Autonomous JSON Database (AJD) and SODA Examples: https://www.slideshare.net/jczuprynski/json-a-splash-of-soda-and-a-sql-chaser-realworld-use-cases-for-autonomous-json-database-ajd OSON - A Deeper Look: https://blogs.oracle.com/jsondb/osonformat http://www.vldb.org/pvldb/vol13/p3059-liu.pdf