Oracle SODA for PL/SQL...
Version 20c

General Information
Library Note Morgan's Library Page Header
The best Oracle News for FY2026

Oracle Database 26ai will be available on generic Linux platforms in January and soon on AIX and Windows
Purpose Simple Oracle Document Access (SODA) for PL/SQL allows PL/SQL functions, packages, and procedures interact with SODA document collections stored in the database.
AUTHID DEFINER
DDL  
Dependencies
DBMS_SODA DBMS_SODA_DOM SODA_CURSOR_T
DBMS_SODACOLL_LIB DBMS_SODA_LIB SODA_DOCUMENT_LIST_T
DBMS_SODACUR DBMS_SODA_UTIL SODA_DOCUMENT_T
DBMS_SODADOC_LIB JSON$USER_COLLECTION_METADATA SODA_KEY_LIST_T
DBMS_SODAOPR_LIB SODA_COLLECTION_T SODA_OPERATION_T
DBMS_SODA_ADMIN SODA_COLLNAME_LIST_T USER_SODA_COLLECTIONS
DBMS_SODA_DML    
Documented No
First Available Not Known
Security Model Owned by SYS with EXECUTE granted to ???
Source {ORACLE_HOME}/rdbms/admin/
Subprograms
     
     
     
 
H
   
 
   
 
H (new 20c)
Create schema and grant privileges conn sys@pdbdev as sysdba

CREATE USER uwsoda
IDENTIFIED BY uwsoda
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
PROFILE default;

GRANT soda_app TO uwsoda;
Create and open a collection, an instance of PL/SQL object type SODA_COLLECTION_T, using the default collection configuration conn uwsoda/uwsoda@pdbdev

CREATE OR REPLACE PROCEDURE sodaproc AUTHID CURRENT USER IS
 collection SODA_COLLECTION_T;
 document   SODA_DOCUMENT_T;
 foundDoc   SODA_DOCUMENT_T;
 resultDoc  SODA_DOCUMENT_T;
 docKey     VARCHAR2(100);
 status     NUMBER;
BEGIN
  -- create a collection
  collection := dbms_soda.create_collection('uwSODACollection');

  -- create a BLOB-based document.
  document := soda_document_t(b_content => utl_raw.cast_to_raw('{"name" : "Morgan"}'));

  -- insert and retrive a document
  resultDoc := collection.insert_one_and_get(document);
  COMMIT;

  -- the document has auto-generated key, version, as well as contents
  -- output the the auto-generated document key
  docKey := resultDoc.get_key;
  dbms_output.put_line('Auto-generated key is: ' || docKey);

  -- return the document by its key
  foundDoc := collection.find_one(docKey);

  -- output document components
  dbms_output.put_line('Document components:');
  dbms_output.put_line(' Key:           ' || foundDoc.get_key);
  dbms_output.put_line(' Content:       ' || utl_raw.cast_to_varchar2(foundDoc.get_blob));
  dbms_output.put_line(' Created:       ' || foundDoc.get_created_on);
  dbms_output.put_line(' Last Modified: ' || foundDoc.get_last_modified);
  dbms_output.put_line(' Version:       ' || foundDoc.get_version);
END sodaproc;
/
   
   
   
   
   
   
   
   

Related Topics
Built-in Functions
Built-in Packages
DBMS_SODA_ADMIN
DBMS_SODA_DML
DBMS_SODA_DOM
DBMS_SODA_UTIL
UTL_RAW
What's New In 21c
What's New In 26ai

Morgan's Library Page Footer
This site is maintained by Daniel Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2026 Daniel A. Morgan All Rights Reserved