2021 – Large Data Structure Changes

Previous posts comparing JSON and RDBMS structure changes used a simple example adding RDBMS date columns or JSON keys. Now its time for something more challenging: Enterprise Master Patient Index (EMPI) All Patients must be given a new master identifier encompassing one or more patient records and their associated Medical Record Numbers (MRN’s) If the … Read more

2021 – Simply Evolving JSON Structure (Updates)

JSON_TRANSFORM can ensure JSON structure when records are inserted into the database using an INSTEAD OF INSERT trigger on a view. CREATE OR REPLACE TRIGGER instead_patient INSTEAD OF INSERT ON migrated_patient BEGIN INSERT INTO json_patient VALUES ( JSON_TRANSFORM(:new.migrated, SET ‘$.unique_os’ = OS_LIST_UNIQUE( JSON_QUERY(:new.migrated,’$.mrns[*].OS’ WITH WRAPPER) ) REPLACE ON EXISTING, INSERT ‘$.mrns[*].sdate’ = SYSDATE IGNORE ON … Read more


My prior posts on JSON_TRANSFORM used simple text values and built-in Oracle functions like SYSDATE. This post demonstrates calling custom PL/SQL functions with JSON_TRANSFORM. Here are the two rows of demo data for this post. The pertinent keys are pname (patient name) and OS (Ordering System) in the elements of the mrns array. SELECT JSON_VALUE … Read more

2021 – JSON_TRANSFORM SET Operation

The simple explanation of the JSON_TRANSFORM SET operation is that it sets values for specified JSON keys. For example “set $.KEY1 to 42′ will set the value of the KEY1 to 42. That’s pretty straightforward. The real power is the additional behaviours that can be defined such as: If $.KEY1 is missing then add it … Read more

2021 – JSON_TRANSFORM Introduction

A previous post in this series dealt with changes to the JSON data structures. Specifically the addition and population of two new key-value pairs. Two other posts here and here showed how object types can be used to make queries simpler as structures change. This is powerful but also quite limited. What we really need … Read more

2021 – JSON Code Changes With Database Unavailable

The last modification for the JSON structure change is the PL/SQL API. First up lets make sure the query API works. BEGIN DBMS_OUTPUT.PUT_LINE(jpatient_pkg.get_pname( p_os => 1, p_mrn => ‘1’)); END; Patient 1 That is the correct result. Now for the add_patient procedure. BEGIN jpatient_pkg.add_patient( p_name => ‘Bob’, p_os => 1, p_mrn => 11 ); END; … Read more