Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

UKOUG Tech15 - Going Full Circle - Building a native JSON Database API

1,723 views

Published on

Presentation used during the UKOUG Technology 2015 conference in Birmingham

Published in: Technology
  • Be the first to comment

UKOUG Tech15 - Going Full Circle - Building a native JSON Database API

  1. 1. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | GOING FULL CIRCLE Building a Native JSON Database API Marco Gralike Principle Consultant Oracle Ace Director eProseed, 09-12-2015 eProseed Confidential
  2. 2. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | AGENDA Introduction Demo References 1 2 3 2
  3. 3. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | INTRODUCTION The supporting slide…? eProseed Confidential3
  4. 4. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | eProseed Confidential4 t: @MGralike w: www.xmldb.nl e: marco.gralike@eproseed.com
  5. 5. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | AGENDA Introduction Demo References 1 2 3 5
  6. 6. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | DEMO eProseed Confidential6
  7. 7. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | AGENDA Introduction Demo References 1 2 3 7
  8. 8. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES Syntax examples and where to go from here… eProseed Confidential8
  9. 9. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES eProseed Confidential9 What is JSON? Basic constructs (recursive)  Base values number, string, boolean, …  Objects { } sets of label-value pairs  Arrays [ ] lists of values
  10. 10. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES eProseed Confidential10 Create Table - IS JSON Clause
  11. 11. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES • 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 eProseed Confidential11 Operators
  12. 12. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES eProseed Confidential12 JSON Path Expressions
  13. 13. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES • Used in the FROM clause • Creation of an inline relational view of JSON eProseed Confidential13 JSON_TABLE (1) 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;
  14. 14. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES eProseed Confidential14 JSON_TABLE (2) 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;
  15. 15. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES • 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 – Return TRUE instead of raising the error eProseed Confidential15 ERROR Handling
  16. 16. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES • 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 eProseed Confidential16 Un/conditional Wrapper
  17. 17. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES eProseed Confidential17 WRAPPER Examples
  18. 18. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES • JSON_TABLE – FORMAT JSON • Forces JSON_QUERY behavior • Therefore can have an explicit wrapper clause – Default • Projection like JSON_VALUE eProseed Confidential18 FORMAT JSON - Clause
  19. 19. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES RESOURCES • XMLDB / JSON Developers Guide • HOWTO: Building a JSON Database API (1) • HOWTO: Building a JSON Database API (2) • HOWTO: Building a JSON Database API (3) • HOWTO: Building a JSON Database API (4) eProseed Confidential19 Where to go from here…
  20. 20. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES RESOURCES • JSON_TABLE (syntax) • A WikiPedia JSON page • WikiPedia API (doc) • JSONView (JSON browser plugin) • UTL_HTTP and SSL (HTTPS) using Oracle Wallets eProseed Confidential20 Where to go from here…
  21. 21. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | REFERENCES RESOURCES • Stanford - Introduction to Databases (JSON) • Eclipse JSON Editor Plugin • JSON Schema • Get Started With JSON • www.json-generator.com • JSON Datasets: www.data.gov eProseed Confidential21 Where to go from here…
  22. 22. Copyright © 2014, eProseed and/or its affiliates. All rights reserved. | eProseed Confidential22

×