JSON Developer's Guide - Oracle

Oracle? Database

JSON Developer's Guide

20c

F14733-03 April 2020

Oracle Database JSON Developer's Guide, 20c

F14733-03

Copyright ? 2015, 2020, Oracle and/or its affiliates.

Primary Author: Drew Adams

Contributors: Oracle JSON development, product management, and quality assurance teams.

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.

Contents

Preface

Audience

xv

Documentation Accessibility

xv

Related Documents

xv

Conventions

xvi

Code Examples

xvii

Part I JSON Data and Oracle Database

1 JSON Data (Standard)

1.1 Overview of JSON

1-1

1.2 JSON Syntax and the Data It Represents

1-2

1.3 JSON Compared with XML

1-5

2 JSON in Oracle Database

2.1 Getting Started Using JSON with Oracle Database 2.2 Overview of JSON in Oracle Database

2.2.1 Data Types for JSON Data 2.2.2 JSON Columns in Database Tables 2.2.3 Use SQL With JSON Data 2.2.4 Use PL/SQL With JSON Data 2.3 JSON Data Type, To and From 2.3.1 JSON Data Type Constructor 2.3.2 Oracle SQL Function JSON_SCALAR 2.3.3 Oracle SQL Function JSON_SERIALIZE 2.3.4 JSON Constructor, JSON_SCALAR, and JSON_SERIALIZE: Summary 2.3.5 Migration of Textual JSON Data to JSON Type Data 2.4 Oracle Database Support for JSON 2.4.1 Support for RFC 8259: JSON Scalars

2-2 2-3 2-5 2-7 2-7 2-8 2-9 2-11 2-12 2-15 2-18 2-20 2-21 2-21

iii

Part II Store and Manage JSON Data 3 Overview of Storing and Managing JSON Data

4 Creating a Table With a JSON Column

4.1 Determining Whether a Column Must Contain Only JSON Data

4-4

5 SQL/JSON Conditions IS JSON and IS NOT JSON

5.1 Unique Versus Duplicate Fields in JSON Objects

5-3

5.2 About Strict and Lax JSON Syntax

5-3

5.3 Specifying Strict or Lax JSON Syntax

5-5

6 Character Sets and Character Encoding for JSON Data

7 Partitioning JSON Data

8 Replication of JSON Data

Part III Insert, Update, and Load JSON Data 9 Overview of Inserting, Updating, and Loading JSON Data

10 Oracle SQL Function JSON_TRANSFORM

11 Oracle SQL Function JSON_MERGEPATCH

12 Loading External JSON Data

iv

Part IV Query JSON Data 13 Simple Dot-Notation Access to JSON Data

14 SQL/JSON Path Expressions

14.1 Overview of SQL/JSON Path Expressions 14.2 SQL/JSON Path Expression Syntax

14.2.1 Basic SQL/JSON Path Expression Syntax 14.2.2 SQL/JSON Path Expression Syntax Relaxation 14.3 SQL/JSON Path Expression Item Methods 14.4 Types in Comparisons

15 Clauses Used in SQL Functions and Conditions for JSON

15.1 RETURNING Clause for SQL Query Functions 15.2 Wrapper Clause for SQL/JSON Query Functions JSON_QUERY and

JSON_TABLE 15.3 Error Clause for SQL Query Functions and Conditions 15.4 Empty-Field Clause for SQL/JSON Query Functions 15.5 ON MISMATCH Clause for JSON_VALUE

16 SQL/JSON Condition JSON_EXISTS

16.1 Using Filters with JSON_EXISTS 16.2 JSON_EXISTS as JSON_TABLE

17 SQL/JSON Function JSON_VALUE

17.1 Using SQL/JSON Function JSON_VALUE With a Boolean JSON Value 17.2 SQL/JSON Function JSON_VALUE Applied to a null JSON Value 17.3 Using JSON_VALUE To Instantiate a User-Defined Object Type Instance 17.4 JSON_VALUE as JSON_TABLE

18 SQL/JSON Function JSON_QUERY

18.1 JSON_QUERY as JSON_TABLE

14-1 14-2 14-2 14-11 14-12 14-20

15-1 15-4 15-7 15-9 15-10

16-2 16-4

17-3 17-4 17-4 17-8

18-3

v

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download