SlideShare a Scribd company logo
Mark D. Drake, Marco Gralike
Manager, Product Management
• ServerTechnology, OracleCorporation
• Oracle 25+ years experience
• XML Infrastructure products in Oracle's
ServerTechnology division
ManagementConsultant
• Ordina,The Netherlands
• Oracle 20+ years experience
• OracleACE Director (www.xmldb.nl)
Basic constructs
(recursive)
 Base values
number, string,
boolean, …
 Objects { }
sets of label-value
pairs
 Arrays [ ]
lists of values
UKOUG Tech14 - Getting Started With JSON in the Database
 New in Oracle Database 12.1.0.2.0
 Store and manage JSON documents in Database
▪ JSON documents stored as text
▪ JSON documents can be indexed
 Access JSON documents via developer-friendly
‘Document-Store’ API’s
 SQL query capabilities over JSON documents for
reporting and analysis
 Allows Oracle RDBMS to be used as a JSON
Document Store
 Enables storing, indexing and querying of JSON
documents
 No new JSON data type
 IS JSON constraint used to ensure a column
contains valid JSON documents
 Apply to CLOB, VARCHAR2, RAW and BLOB data
 Enables use of .dotted notation to navigate JSON
document structure and access content
 Flexible Schema development
 JSON data can also be
 Partitioned
 Used with Flashback
 Recovered (when proper backup is in place)
 Used with Securefile storage
▪ Smaller storage
▪ Encryption, Deduplication, Compressed
 Multiple index options
 Caching advantages, etc., etc.,…
UKOUG Tech14 - Getting Started With JSON in the Database
 JSON content is accessible from SQL via
new operators
 JSON operators use JSON Path
language to navigate JSON objects
 Proposed extention to SQL standards
 The JSON Path language makes it possible to
address the contents of a JSON document
 A JSON path expression can address 1 of 4 items
▪ The entire object, a scalar value, an array, a specific object
 JSON Path expressions are similar to XPath
Expressions
▪ The entire document is referenced by $
▪ All JSON path expressions start with a $ symbol
▪ Key names are separated by a ’.’ (period)
 JSON Path expressions are case sensitive
JSON Path Expression Type Contents
$.Reference String "ABULL-20120421"
$.ShippingInstructions.Address.zipcode Number 99236
$.ShippingInstructions.Address Object
{ "street": "200 SportingGreen",
"city": "South San Francisco",
"state": "CA",
"zipCode": 99236,
"country": “USA"
}
$LineItems Array
[ { "ItemNumber" : 1,
"Part" : {
"Description" : “Christmas”
"UPCCode" : 13131092899 }
},
{ "ItemNumber" : 2,
"Part" : {
"Description" : “Easter”
"UPCCode" : 13131092899 }
]
 Compatible with Java Script
 $.phone[0]
 Wildcards, Multi-Selects, Ranges
 $.phone[*], $.phone[0,1 5 to 9]
 Predicates
 .address?(.zip > $zip)
 SQL conversion functions usable in
predicates
 .?(to_date(.date) > $date)
UKOUG Tech14 - Getting Started With JSON in the Database
 JSON_VALUE
 Return a single scalar value from a JSON Document
 JSON_QUERY
 Return a JSON Object or JSON Array from a JSON
Document
 JSON_EXISTS
 Filter rows based on JSON-PATH expressions
 JSON_TABLE
 Project in-line, nested relational views from JSON
Documents
 JSON_TEXTCONTAINS
 JSON aware full-text searching of JSON Documents
Proposed extension to SQL standards
 Using .dotted notation
SQL> select j.PO_DOCUMENT
2 from J_PURCHASEORDER j
3 where j.PO_DOCUMENT.PONumber = 1600
4 /
SQL> select j.PO_DOCUMENT.ShippingInstructions.Address
2 from J_PURCHASEORDER j
3 where j.PO_DOCUMENT.PONumber = 1600
4 /
 Can only return a SCALAR value
SQL> select JSON_VALUE(PO_DOCUMENT,
2 '$.LineItems[0].Part.UnitPrice'
3 returning NUMBER(5,3))
4 from J_PURCHASEORDER p
5 where JSON_VALUE(PO_DOCUMENT,
6 '$.PONumber' returning NUMBER(10)) = 1600 ;
 Can only returns an ARRAY or OBJECT
SELECT JSON_QUERY('{a:100, b:200, c:300}', '$.*' WITH WRAPPER)
AS value
FROM DUAL;
VALUE
--------------------------------------------------------------------------------
[100,200,300]
 Used in theWHERE clause
SQL> select count(*)
2 from J_PURCHASEORDER
3 where JSON_EXISTS( PO_DOCUMENT
4 , '$.ShippingInstructions.Address.state')
5 /
 Used in the FROM clause
 Creation of an inline relational view of JSON
SQL> SELECT m.*
2 FROM J_PURCHASEORDER p
3 , JSON_TABLE
4 ( p.PO_DOCUMENT, '$'
5 columns
6 po_rno FOR ORDINALITY,
7 po_number NUMBER(10) path '$.PONumber'
8 ) m
9 WHERE po_number > 1600 and PO_Number < 1605;
SQL> SELECT m.*
2 FROM J_PURCHASEORDER p
3 , JSON_TABLE
4 ( p.PO_DOCUMENT, '$'
5 columns
6 po_number NUMBER(10) path '$.PONumber',
7 reference VARCHAR2(30) path '$.Reference',
8 requestor VARCHAR2(32) path '$.Requestor',
9 userid VARCHAR2(10) path '$.User',
10 center VARCHAR2(16) path '$.CostCenter'
11 ) m
12 WHERE po_number > 1600 and PO_Number < 1605;
 1 row output for each row in table
PO_NUMBER REFERENCE REQUSTOR USERID CENTER
1600 ABULL-20140421 Alexis Bull ABULL A50
1601 ABULL-20140423 Alexis Bull ABULL A50
1602 ABULL-20140430 Alexis Bull ABULL A50
1603 KCHUNG-20141022 Kelly Chung KCHUNG A50
1604 LBISSOT-20141009 Laura Bissot LBISSOT A50
create or replace view J_PURCHASEORDER_DETAIL_VIEW as
select d.*
from J_PURCHASEORDER p,
JSON_TABLE
(p.PO_DOCUMENT, '$'
columns (
PO_NUMBER NUMBER(10) path '$.PONumber',
USERID VARCHAR2(10) path '$.User',
COSTCENTER VARCHAR2(16) path '$.CostCenter',
NESTED PATH '$.LineItems[*]'
columns
( ITEMNO NUMBER(38) path '$.ItemNumber',
UNITPRICE NUMBER(14,2) path '$.Part.UnitPrice'
) ) ) d;
 Full-text search of JSON data that is stored in
aVARCHAR2, BLOB, or CLOB column
 Must be used in conjunction with special
JSON OracleText Index
 Use CTXSYS.JSON_SECTION_GROUP
SQL> SELECT po_document
2 FROM j_purchaseorder
3 WHERE JSON_TEXTCONTAINS
4 ( po_document
5 , '$.LineItems.Part.Description'
6 , 'Magic' );
Execution path
|* | DOMAIN INDEX | PO_SEARCH_IDX | | | 4 (0)
UKOUG Tech14 - Getting Started With JSON in the Database
 Check constraint guarantees that values are
valid JSON documents
 IS [NOT] JSON predicate
 ReturnsTRUE if column value is JSON, FALSE
otherwise
 Full parse of the data while validating syntax
 Tolerant and strict modes
 Use to ensure that the documents stored in a
column are valid JSON
 LAX
 Default
 STRICT
 Among others:
▪ JSON property (key) name and each string value must be enclosed
in double quotation marks (")
▪ Fractional numerals must have leading zero ( 0.14 | .14)
▪ XML DB Developers Guide or JSON Standards (ECMA-404 / 262)
 More performance intensive than Lax
create table J_PURCHASEORDER
( ID RAW(16) NOT NULL,
DATE_LOADED TIMESTAMP(6) WITHTIME ZONE,
PO_DOCUMENT CLOB
CHECK (PO_DOCUMENT IS JSON) )
insert into J_PURCHASEORDER values(‘0x1’,‘{Invalid JSONText}');
ERROR at line 1:
ORA-02290: check constraint (DEMO.IS_VALID_JSON) violated
 ALL_JSON_COLUMNS
 DBA_JSON_COLUMNS
 USER_JSON_COLUMNS
 Will not show up when
 Check constraint combines condition IS JSON
with another condition using logical condition OR
 “jcol is json OR length(jcol) < 1000” ???
-- Default (lax)
SQL> SELECT json_column
2 FROM t
3 WHERE ( json_column IS JSON);
-- Explicit
SQL> SELECT json_column
2 FROM t
3 WHERE ( json_column IS JSON (STRICT));
SQL> insert into J_PURCHASEORDER
2 select SYS_GUID(),
3 SYSTIMESTAMP,
4 JSON_DOCUMENT
5 from STAGING_TABLE
6 where JSON_DOCUMENT IS JSON;
SQL> delete from STAGING_TABLE
2 where DOCUMENT IS NOT JSON;
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
 NULL on ERROR
 The Default
 Return NULL instead of raising the error
 ERROR on ERROR
 Raise the error (no special handling)
 TRUE ON ERROR
 In JSON_EXISTS
 ReturnTRUE instead of raising the error
 FALSE ON ERROR
 In JSON_EXISTS
 Return FALSE instead of raising the error
 EMPTY ON ERROR
 In JSON_QUERY
 Return an empty array ([]) instead of raising the error
 DEFAULT 'literal_value' ON ERROR
 Return the specified value instead of raising the error
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
 RETURNING clause
 PRETTY
▪ Can only be used in JSON_QUERY
▪ Pretty-print the returned data
 ASCII
▪ Can only be used in JSON_VALUE, JSON_QUERY
▪ Automatically escape all non-ASCII Unicode characters
in the returned data, using standard ASCII Unicode
 JSON_TABLE, JSON_QUERY
 WITHOUT WRAPPER
▪ Default, no change
▪ Raise error, if scalar/multiple values in non JSON result
 WITH WRAPPER
▪ Wrap result as a JSON ARRAY [ ]
 WITH CONDITIONAL WRAPPER
▪ Wrap result as a JSON ARRAY [ ]
▪ Don’t wrap result if scalar/multiple values in JSON result
JSON
Example
WITH WRAPPER WITHOUT
WRAPPER
WITH CONDITIONAL
WRAPPER
{"id": 38327}
(single object)
[{"id": 38327}] {"id": 38327} {"id": 38327}
[42, "a", true]
(single array)
[[42, "a", true]] [42, "a", true] [42, "a", true]
42 [42] Error
(scalar)
[42]
42, "a", true [42, "a", true] Error
(multiple values)
[42, "a", true]
none [] Error
(no values)
[]
For a single JSON object or array value, it is the same as WITHOUT WRAPPER.
 JSON_TABLE
 FORMAT JSON
▪ Forces JSON_QUERY behavior
▪ Therefore can have an explicit wrapper clause
 Default
▪ Projection like JSON_VALUE
UKOUG Tech14 - Getting Started With JSON in the Database
filelist.dat
./data/www.json-generator.com.01.json
./data/www.json-generator.com.02.json
./data/www.json-generator.com.03.json
./data/www.json-generator.com.04.json
./data/www.json-generator.com.05.json
./data/www.json-generator.com.06.json
./data/www.json-generator.com.07.json
./data/www.json-generator.com.08.json
./data/www.json-generator.com.09.json
./data/www.json-generator.com.10.json
sqlldr.sh
sqlldr userid=json/json control=sqlldr.ctl log=sqlldr.log bad=sqlldr.bad
sqlldr.ctl
LOAD DATA
INFILE 'filelist.dat'
truncate
INTO table JSON_DATA
FIELDSTERMINATED BY ',‘
( clob_filename filler char(120)
, clob_content LOBFILE(clob_filename) TERMINATED BY EOF
, nclob_filename filler char(120)
, nclob_content LOBFILE(nclob_filename)TERMINATED BY EOF
, bfile_filename filler char(120)
, bfile_content BFILE(CONSTANT "JSON_LOAD", bfile_filename))
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
create unique index PO_NUMBER_IDX
on J_PURCHASEORDER
(JSON_VALUE ( PO_DOCUMENT, '$.PONumber'
returning NUMBER(10)
ERROR ON ERROR));
create bitmap index COSTCENTER_IDX
on J_PURCHASEORDER
(JSON_VALUE (PO_DOCUMENT, '$.CostCenter'));
UKOUG Tech14 - Getting Started With JSON in the Database
 Path Expressions
 Operators
 Functions
 Conditions
 Error Handling
 Returning results
 Loading JSON data
 Indexing JSON data
 Oracle Database SQL
Language Reference
 JSON Functions
▪ JSON_QUERY
▪ JSON_TABLE
▪ JSON_VALUE
 JSON Conditions
▪ IS JSON
▪ JSON_EXISTS
▪ JSON_TEXTCONTAINS
 Oracle XMLDB
Developers Guide
 JSON in DB 12.1.0.2
 JSON Path Expressions
▪ Syntax
 Indexing JSON
▪ Syntax
 Loading JSON
▪ A Method
 JSON on xmldb.nl
 Stanford - Introduction to Databases (JSON)
 Eclipse JSON Editor Plugin
 JSONView addon (Firefox/Chrome)
 JSON Schema
 Get StartedWith JSON
 www.json-generator.com
 JSON Datasets: www.data.gov
Ad

More Related Content

What's hot (19)

UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server
UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File ServerUKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server
UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server
Marco Gralike
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XMLODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XML
Marco Gralike
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
Marco Gralike
 
BGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index StrategiesBGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index Strategies
Marco Gralike
 
Hotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured DataHotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured Data
Marco Gralike
 
JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)
Faysal Shaarani (MBA)
 
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
 
XML Amsterdam - Creating structure in unstructured data
XML Amsterdam - Creating structure in unstructured dataXML Amsterdam - Creating structure in unstructured data
XML Amsterdam - Creating structure in unstructured data
Marco Gralike
 
Xml
XmlXml
Xml
Yoga Raja
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2
Marco Gralike
 
Polyglot Persistence
Polyglot PersistencePolyglot Persistence
Polyglot Persistence
Scott Leberknight
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
Kiev ALT.NET
 
XFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereXFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in there
Marco Gralike
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
Scott Leberknight
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operations
anujaggarwal49
 
Full metal mongo
Full metal mongoFull metal mongo
Full metal mongo
Israel Gutiérrez
 
Erlang for data ops
Erlang for data opsErlang for data ops
Erlang for data ops
mnacos
 
BGOUG 2012 - Design concepts for xml applications that will perform
BGOUG 2012 - Design concepts for xml applications that will performBGOUG 2012 - Design concepts for xml applications that will perform
BGOUG 2012 - Design concepts for xml applications that will perform
Marco Gralike
 
UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server
UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File ServerUKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server
UKOUG 2011 - Drag, Drop and other Stuff. Using your Database as a File Server
Marco Gralike
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XMLODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XML
Marco Gralike
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
Marco Gralike
 
BGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index StrategiesBGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index Strategies
Marco Gralike
 
Hotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured DataHotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured Data
Marco Gralike
 
JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)JSON Data Parsing in Snowflake (By Faysal Shaarani)
JSON Data Parsing in Snowflake (By Faysal Shaarani)
Faysal Shaarani (MBA)
 
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
 
XML Amsterdam - Creating structure in unstructured data
XML Amsterdam - Creating structure in unstructured dataXML Amsterdam - Creating structure in unstructured data
XML Amsterdam - Creating structure in unstructured data
Marco Gralike
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 2
Marco Gralike
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
Kiev ALT.NET
 
XFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in thereXFILES, The APEX 4 version - The truth is in there
XFILES, The APEX 4 version - The truth is in there
Marco Gralike
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
Scott Leberknight
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operations
anujaggarwal49
 
Erlang for data ops
Erlang for data opsErlang for data ops
Erlang for data ops
mnacos
 
BGOUG 2012 - Design concepts for xml applications that will perform
BGOUG 2012 - Design concepts for xml applications that will performBGOUG 2012 - Design concepts for xml applications that will perform
BGOUG 2012 - Design concepts for xml applications that will perform
Marco Gralike
 

Similar to UKOUG Tech14 - Getting Started With JSON in the Database (20)

Store non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONStore non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSON
Alireza Kamrani
 
Going Native: Leveraging the New JSON Native Datatype in Oracle 21c
Going Native: Leveraging the New JSON Native Datatype in Oracle 21cGoing Native: Leveraging the New JSON Native Datatype in Oracle 21c
Going Native: Leveraging the New JSON Native Datatype in Oracle 21c
Jim Czuprynski
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
Dave Stokes
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
Maria Colgan
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
stewashton
 
Native JSON Support in SQL2016
Native JSON Support in SQL2016Native JSON Support in SQL2016
Native JSON Support in SQL2016
Ivo Andreev
 
Power JSON with PostgreSQL
Power JSON with PostgreSQLPower JSON with PostgreSQL
Power JSON with PostgreSQL
EDB
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
AmitSharma397241
 
Json
JsonJson
Json
soumya
 
Json
JsonJson
Json
Raphael Wanjiku
 
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Andrii Lashchenko
 
Json at work overview and ecosystem-v2.0
Json at work   overview and ecosystem-v2.0Json at work   overview and ecosystem-v2.0
Json at work overview and ecosystem-v2.0
Boulder Java User's Group
 
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
 
JSON in 18c and 19c
JSON in 18c and 19cJSON in 18c and 19c
JSON in 18c and 19c
stewashton
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Lucas Jellema
 
Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !Oh, that ubiquitous JSON !
Oh, that ubiquitous JSON !
Alexander Korotkov
 
Json
JsonJson
Json
Prabhat gangwar
 
Json the-x-in-ajax1588
Json the-x-in-ajax1588Json the-x-in-ajax1588
Json the-x-in-ajax1588
Ramamohan Chokkam
 
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
 
Json in 18c and 19c
Json in 18c and 19cJson in 18c and 19c
Json in 18c and 19c
stewashton
 
Store non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONStore non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSON
Alireza Kamrani
 
Going Native: Leveraging the New JSON Native Datatype in Oracle 21c
Going Native: Leveraging the New JSON Native Datatype in Oracle 21cGoing Native: Leveraging the New JSON Native Datatype in Oracle 21c
Going Native: Leveraging the New JSON Native Datatype in Oracle 21c
Jim Czuprynski
 
Validating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentationValidating JSON -- Percona Live 2021 presentation
Validating JSON -- Percona Live 2021 presentation
Dave Stokes
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
Maria Colgan
 
JSON in Oracle 18c and 19c
JSON in Oracle 18c and 19cJSON in Oracle 18c and 19c
JSON in Oracle 18c and 19c
stewashton
 
Native JSON Support in SQL2016
Native JSON Support in SQL2016Native JSON Support in SQL2016
Native JSON Support in SQL2016
Ivo Andreev
 
Power JSON with PostgreSQL
Power JSON with PostgreSQLPower JSON with PostgreSQL
Power JSON with PostgreSQL
EDB
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
AmitSharma397241
 
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Andrii Lashchenko
 
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
 
JSON in 18c and 19c
JSON in 18c and 19cJSON in 18c and 19c
JSON in 18c and 19c
stewashton
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Lucas Jellema
 
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
 
Json in 18c and 19c
Json in 18c and 19cJson in 18c and 19c
Json in 18c and 19c
stewashton
 
Ad

More from Marco Gralike (14)

UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxUKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
Marco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudeProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
Marco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
Marco Gralike
 
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIUKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
Marco Gralike
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open World
Marco Gralike
 
An introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xAn introduction into Oracle VM V3.x
An introduction into Oracle VM V3.x
Marco Gralike
 
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
Marco Gralike
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)
Marco Gralike
 
Flexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenFlexibiliteit & Snel Schakelen
Flexibiliteit & Snel Schakelen
Marco Gralike
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use Cases
Marco Gralike
 
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file serverBGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
Marco Gralike
 
Amis ACE
Amis ACEAmis ACE
Amis ACE
Marco Gralike
 
XML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDBXML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDB
Marco Gralike
 
Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will Perform
Marco Gralike
 
UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxUKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
Marco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudeProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
Marco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
Marco Gralike
 
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIUKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
Marco Gralike
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open World
Marco Gralike
 
An introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xAn introduction into Oracle VM V3.x
An introduction into Oracle VM V3.x
Marco Gralike
 
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
Marco Gralike
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)
Marco Gralike
 
Flexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenFlexibiliteit & Snel Schakelen
Flexibiliteit & Snel Schakelen
Marco Gralike
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use Cases
Marco Gralike
 
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file serverBGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
Marco Gralike
 
XML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDBXML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDB
Marco Gralike
 
Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will Perform
Marco Gralike
 
Ad

Recently uploaded (20)

Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Alan Dix
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More MachinesRefactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Leon Anavi
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptxUiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
anabulhac
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
accessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electricaccessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electric
UXPA Boston
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural NetworksDistributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Ivan Ruchkin
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
How Top Companies Benefit from Outsourcing
How Top Companies Benefit from OutsourcingHow Top Companies Benefit from Outsourcing
How Top Companies Benefit from Outsourcing
Nascenture
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
Top Hyper-Casual Game Studio Services
Top  Hyper-Casual  Game  Studio ServicesTop  Hyper-Casual  Game  Studio Services
Top Hyper-Casual Game Studio Services
Nova Carter
 
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Alan Dix
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More MachinesRefactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Leon Anavi
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptxUiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
anabulhac
 
accessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electricaccessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electric
UXPA Boston
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural NetworksDistributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Ivan Ruchkin
 
How Top Companies Benefit from Outsourcing
How Top Companies Benefit from OutsourcingHow Top Companies Benefit from Outsourcing
How Top Companies Benefit from Outsourcing
Nascenture
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
Top Hyper-Casual Game Studio Services
Top  Hyper-Casual  Game  Studio ServicesTop  Hyper-Casual  Game  Studio Services
Top Hyper-Casual Game Studio Services
Nova Carter
 

UKOUG Tech14 - Getting Started With JSON in the Database

  • 1. Mark D. Drake, Marco Gralike
  • 2. Manager, Product Management • ServerTechnology, OracleCorporation • Oracle 25+ years experience • XML Infrastructure products in Oracle's ServerTechnology division
  • 3. ManagementConsultant • Ordina,The Netherlands • Oracle 20+ years experience • OracleACE Director (www.xmldb.nl)
  • 4. Basic constructs (recursive)  Base values number, string, boolean, …  Objects { } sets of label-value pairs  Arrays [ ] lists of values
  • 6.  New in Oracle Database 12.1.0.2.0  Store and manage JSON documents in Database ▪ JSON documents stored as text ▪ JSON documents can be indexed  Access JSON documents via developer-friendly ‘Document-Store’ API’s  SQL query capabilities over JSON documents for reporting and analysis
  • 7.  Allows Oracle RDBMS to be used as a JSON Document Store  Enables storing, indexing and querying of JSON documents  No new JSON data type  IS JSON constraint used to ensure a column contains valid JSON documents  Apply to CLOB, VARCHAR2, RAW and BLOB data  Enables use of .dotted notation to navigate JSON document structure and access content
  • 8.  Flexible Schema development
  • 9.  JSON data can also be  Partitioned  Used with Flashback  Recovered (when proper backup is in place)  Used with Securefile storage ▪ Smaller storage ▪ Encryption, Deduplication, Compressed  Multiple index options  Caching advantages, etc., etc.,…
  • 11.  JSON content is accessible from SQL via new operators  JSON operators use JSON Path language to navigate JSON objects  Proposed extention to SQL standards
  • 12.  The JSON Path language makes it possible to address the contents of a JSON document  A JSON path expression can address 1 of 4 items ▪ The entire object, a scalar value, an array, a specific object  JSON Path expressions are similar to XPath Expressions ▪ The entire document is referenced by $ ▪ All JSON path expressions start with a $ symbol ▪ Key names are separated by a ’.’ (period)  JSON Path expressions are case sensitive
  • 13. JSON Path Expression Type Contents $.Reference String "ABULL-20120421" $.ShippingInstructions.Address.zipcode Number 99236 $.ShippingInstructions.Address Object { "street": "200 SportingGreen", "city": "South San Francisco", "state": "CA", "zipCode": 99236, "country": “USA" } $LineItems Array [ { "ItemNumber" : 1, "Part" : { "Description" : “Christmas” "UPCCode" : 13131092899 } }, { "ItemNumber" : 2, "Part" : { "Description" : “Easter” "UPCCode" : 13131092899 } ]
  • 14.  Compatible with Java Script  $.phone[0]  Wildcards, Multi-Selects, Ranges  $.phone[*], $.phone[0,1 5 to 9]  Predicates  .address?(.zip > $zip)  SQL conversion functions usable in predicates  .?(to_date(.date) > $date)
  • 16.  JSON_VALUE  Return a single scalar value from a JSON Document  JSON_QUERY  Return a JSON Object or JSON Array from a JSON Document  JSON_EXISTS  Filter rows based on JSON-PATH expressions  JSON_TABLE  Project in-line, nested relational views from JSON Documents  JSON_TEXTCONTAINS  JSON aware full-text searching of JSON Documents Proposed extension to SQL standards
  • 17.  Using .dotted notation SQL> select j.PO_DOCUMENT 2 from J_PURCHASEORDER j 3 where j.PO_DOCUMENT.PONumber = 1600 4 / SQL> select j.PO_DOCUMENT.ShippingInstructions.Address 2 from J_PURCHASEORDER j 3 where j.PO_DOCUMENT.PONumber = 1600 4 /
  • 18.  Can only return a SCALAR value SQL> select JSON_VALUE(PO_DOCUMENT, 2 '$.LineItems[0].Part.UnitPrice' 3 returning NUMBER(5,3)) 4 from J_PURCHASEORDER p 5 where JSON_VALUE(PO_DOCUMENT, 6 '$.PONumber' returning NUMBER(10)) = 1600 ;
  • 19.  Can only returns an ARRAY or OBJECT SELECT JSON_QUERY('{a:100, b:200, c:300}', '$.*' WITH WRAPPER) AS value FROM DUAL; VALUE -------------------------------------------------------------------------------- [100,200,300]
  • 20.  Used in theWHERE clause SQL> select count(*) 2 from J_PURCHASEORDER 3 where JSON_EXISTS( PO_DOCUMENT 4 , '$.ShippingInstructions.Address.state') 5 /
  • 21.  Used in the FROM clause  Creation of an inline relational view of JSON SQL> SELECT m.* 2 FROM J_PURCHASEORDER p 3 , JSON_TABLE 4 ( p.PO_DOCUMENT, '$' 5 columns 6 po_rno FOR ORDINALITY, 7 po_number NUMBER(10) path '$.PONumber' 8 ) m 9 WHERE po_number > 1600 and PO_Number < 1605;
  • 22. SQL> SELECT m.* 2 FROM J_PURCHASEORDER p 3 , JSON_TABLE 4 ( p.PO_DOCUMENT, '$' 5 columns 6 po_number NUMBER(10) path '$.PONumber', 7 reference VARCHAR2(30) path '$.Reference', 8 requestor VARCHAR2(32) path '$.Requestor', 9 userid VARCHAR2(10) path '$.User', 10 center VARCHAR2(16) path '$.CostCenter' 11 ) m 12 WHERE po_number > 1600 and PO_Number < 1605;
  • 23.  1 row output for each row in table PO_NUMBER REFERENCE REQUSTOR USERID CENTER 1600 ABULL-20140421 Alexis Bull ABULL A50 1601 ABULL-20140423 Alexis Bull ABULL A50 1602 ABULL-20140430 Alexis Bull ABULL A50 1603 KCHUNG-20141022 Kelly Chung KCHUNG A50 1604 LBISSOT-20141009 Laura Bissot LBISSOT A50
  • 24. create or replace view J_PURCHASEORDER_DETAIL_VIEW as select d.* from J_PURCHASEORDER p, JSON_TABLE (p.PO_DOCUMENT, '$' columns ( PO_NUMBER NUMBER(10) path '$.PONumber', USERID VARCHAR2(10) path '$.User', COSTCENTER VARCHAR2(16) path '$.CostCenter', NESTED PATH '$.LineItems[*]' columns ( ITEMNO NUMBER(38) path '$.ItemNumber', UNITPRICE NUMBER(14,2) path '$.Part.UnitPrice' ) ) ) d;
  • 25.  Full-text search of JSON data that is stored in aVARCHAR2, BLOB, or CLOB column  Must be used in conjunction with special JSON OracleText Index  Use CTXSYS.JSON_SECTION_GROUP
  • 26. SQL> SELECT po_document 2 FROM j_purchaseorder 3 WHERE JSON_TEXTCONTAINS 4 ( po_document 5 , '$.LineItems.Part.Description' 6 , 'Magic' ); Execution path |* | DOMAIN INDEX | PO_SEARCH_IDX | | | 4 (0)
  • 28.  Check constraint guarantees that values are valid JSON documents  IS [NOT] JSON predicate  ReturnsTRUE if column value is JSON, FALSE otherwise  Full parse of the data while validating syntax  Tolerant and strict modes  Use to ensure that the documents stored in a column are valid JSON
  • 29.  LAX  Default  STRICT  Among others: ▪ JSON property (key) name and each string value must be enclosed in double quotation marks (") ▪ Fractional numerals must have leading zero ( 0.14 | .14) ▪ XML DB Developers Guide or JSON Standards (ECMA-404 / 262)  More performance intensive than Lax
  • 30. create table J_PURCHASEORDER ( ID RAW(16) NOT NULL, DATE_LOADED TIMESTAMP(6) WITHTIME ZONE, PO_DOCUMENT CLOB CHECK (PO_DOCUMENT IS JSON) ) insert into J_PURCHASEORDER values(‘0x1’,‘{Invalid JSONText}'); ERROR at line 1: ORA-02290: check constraint (DEMO.IS_VALID_JSON) violated
  • 31.  ALL_JSON_COLUMNS  DBA_JSON_COLUMNS  USER_JSON_COLUMNS  Will not show up when  Check constraint combines condition IS JSON with another condition using logical condition OR  “jcol is json OR length(jcol) < 1000” ???
  • 32. -- Default (lax) SQL> SELECT json_column 2 FROM t 3 WHERE ( json_column IS JSON); -- Explicit SQL> SELECT json_column 2 FROM t 3 WHERE ( json_column IS JSON (STRICT));
  • 33. SQL> insert into J_PURCHASEORDER 2 select SYS_GUID(), 3 SYSTIMESTAMP, 4 JSON_DOCUMENT 5 from STAGING_TABLE 6 where JSON_DOCUMENT IS JSON; SQL> delete from STAGING_TABLE 2 where DOCUMENT IS NOT JSON;
  • 36.  NULL on ERROR  The Default  Return NULL instead of raising the error  ERROR on ERROR  Raise the error (no special handling)  TRUE ON ERROR  In JSON_EXISTS  ReturnTRUE instead of raising the error
  • 37.  FALSE ON ERROR  In JSON_EXISTS  Return FALSE instead of raising the error  EMPTY ON ERROR  In JSON_QUERY  Return an empty array ([]) instead of raising the error  DEFAULT 'literal_value' ON ERROR  Return the specified value instead of raising the error
  • 42.  RETURNING clause  PRETTY ▪ Can only be used in JSON_QUERY ▪ Pretty-print the returned data  ASCII ▪ Can only be used in JSON_VALUE, JSON_QUERY ▪ Automatically escape all non-ASCII Unicode characters in the returned data, using standard ASCII Unicode
  • 43.  JSON_TABLE, JSON_QUERY  WITHOUT WRAPPER ▪ Default, no change ▪ Raise error, if scalar/multiple values in non JSON result  WITH WRAPPER ▪ Wrap result as a JSON ARRAY [ ]  WITH CONDITIONAL WRAPPER ▪ Wrap result as a JSON ARRAY [ ] ▪ Don’t wrap result if scalar/multiple values in JSON result
  • 44. JSON Example WITH WRAPPER WITHOUT WRAPPER WITH CONDITIONAL WRAPPER {"id": 38327} (single object) [{"id": 38327}] {"id": 38327} {"id": 38327} [42, "a", true] (single array) [[42, "a", true]] [42, "a", true] [42, "a", true] 42 [42] Error (scalar) [42] 42, "a", true [42, "a", true] Error (multiple values) [42, "a", true] none [] Error (no values) [] For a single JSON object or array value, it is the same as WITHOUT WRAPPER.
  • 45.  JSON_TABLE  FORMAT JSON ▪ Forces JSON_QUERY behavior ▪ Therefore can have an explicit wrapper clause  Default ▪ Projection like JSON_VALUE
  • 48. sqlldr.ctl LOAD DATA INFILE 'filelist.dat' truncate INTO table JSON_DATA FIELDSTERMINATED BY ',‘ ( clob_filename filler char(120) , clob_content LOBFILE(clob_filename) TERMINATED BY EOF , nclob_filename filler char(120) , nclob_content LOBFILE(nclob_filename)TERMINATED BY EOF , bfile_filename filler char(120) , bfile_content BFILE(CONSTANT "JSON_LOAD", bfile_filename))
  • 51. create unique index PO_NUMBER_IDX on J_PURCHASEORDER (JSON_VALUE ( PO_DOCUMENT, '$.PONumber' returning NUMBER(10) ERROR ON ERROR)); create bitmap index COSTCENTER_IDX on J_PURCHASEORDER (JSON_VALUE (PO_DOCUMENT, '$.CostCenter'));
  • 53.  Path Expressions  Operators  Functions  Conditions  Error Handling  Returning results  Loading JSON data  Indexing JSON data
  • 54.  Oracle Database SQL Language Reference  JSON Functions ▪ JSON_QUERY ▪ JSON_TABLE ▪ JSON_VALUE  JSON Conditions ▪ IS JSON ▪ JSON_EXISTS ▪ JSON_TEXTCONTAINS  Oracle XMLDB Developers Guide  JSON in DB 12.1.0.2  JSON Path Expressions ▪ Syntax  Indexing JSON ▪ Syntax  Loading JSON ▪ A Method  JSON on xmldb.nl
  • 55.  Stanford - Introduction to Databases (JSON)  Eclipse JSON Editor Plugin  JSONView addon (Firefox/Chrome)  JSON Schema  Get StartedWith JSON  www.json-generator.com  JSON Datasets: www.data.gov
  翻译: