A huge “Well done!” to all those people that made the realisation that we had to be storing the data in a datatype that can manipulate the data internally as it is stored. Thus datatypes like JSON and XMLTYPE became the obvious candidates.
No-one matched exactly the way I constructed the problem, but for those of you that tinkered around until you could then find the right combination of JSON fragment until the data matched the numbers I provided in my example – I call that a successful solution to the quiz!
Give yourself a pat on the back!
So what was my construction? Yes it was JSON but another clue with the column name of DATA. I used a new type of table in 23ai
SQL> create json collection table t;
Table created.
One of interesting things about this table is that if you provide an element as a unique identifier, we will go ahead and use it.
SQL> insert into t values ('{"_id":123123,"Merry":"Christmas"}');
1 row created.
SQL> select data from t;
DATA
---------------------------------------
{"_id":123123,"Merry":"Christmas"}
But if you do not, then we will automatically add one to the JSON
SQL> insert into t values ('{"Merry":"Xmas!!"}');
1 row created.
SQL> select data from t;
DATA
-------------------------------------------------------
{"_id":"676cd9d6b9ed3fcde32de8f3","Merry":"Xmas!!"}
And that is hence a very easy way to insert less data and end up with a longer length result as per what you saw in the puzzle.
SQL> select length(data), data from t;
LENGTH(DATA) DATA
------------ --------------------------------------------------------
52 {"_id":123123,"Merry":"Christmas"}
58 {"_id":"676cd9d6b9ed3fcde32de8f3","Merry":"Xmas!!"}
Happy New Year!




Leave a reply to Connor McDonald Cancel reply