Search notes:

Oracle JSON related PL/SQL types: SELECT INTO

Because of the ORA-40573: invalid use of PL/SQL JSON object type error, the result of json_arrayagg cannot be used in a PL/SQL select … into clause to create a json_array_t or json_object_t instance.
Rather, the result must first be selected into a clob and then the desired type be created:
declare
   res_clb clob;
   res_typ json_array_t;
begin
   select
      json_arrayagg(json_array(column_name, data_type)) into res_clb
   from
      all_tab_columns
   where
      table_name = 'USER_TAB_COLUMNS'
   ;
 
   res_typ := json_array_t.parse(res_clb);
  
   dbms_output.put_line(res_typ.to_string);
end;
/

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...', 1745927750, '18.217.1.165', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/types/json/select-into(51): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78