Search notes:

Oracle JSON related PL/SQL types: Reference semantics

By default JSON related PL/SQL types have reference semantics:
declare
   jsn json_object_t;
  
   ary json_array_t;
   obj json_object_t;
begin
 
   jsn := json_object_t.parse('{
      "scl":  17,
      "ary": [1,2,3],
      "obj": {"num": 42}
   }');
  
   ary := jsn.get_array('ary');
   ary.append(4);
  
   obj := jsn.get_object('obj');
   obj.put('txt','Hello world');
  
   dbms_output.put_line(jsn.to_string(pretty=>true));
  
end;
/
--
-- {
--   "scl" : 17,
--   "ary" :
--   [
--     1,
--     2,
--     3,
--     4
--   ],
--   "obj" :
--   {
--     "num" : 42,
--     "txt" : "Hello world"
--   }
-- }

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745928581, '3.17.156.160', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/types/json/reference-semantics(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78