Diving Deeper: What’s New for Developers in Oracle Database 23.6, with Code

Lavanya Alapati

introduction

Oracle’s latest release, Oracle Database 23.6, is packed with significant enhancements that empower developers to build more intelligent, efficient, and modern applications. Building on the foundation of Oracle Database 23c, this release goes beyond incremental updates, offering powerful new tools for AI, transaction management, and JSON handling.

Let’s move past the headlines and dive into the technical details, complete with code examples, to see how you can leverage these new capabilities in your projects.

Supercharge Your Apps with AI Vector Search Enhancements

AI Vector Search was a headline feature in 23c, and version 23.6 makes it even more powerful and easier to use. Vectors are mathematical representations of unstructured data (like text, images, or audio), and vector search allows you to find items based on semantic similarity rather than just keywords.

				
					SQL

-- First, create the table to hold our product data and vectors
CREATE TABLE product_descriptions (
  id           NUMBER PRIMARY KEY,
  description  VARCHAR2(1000),
  description_vector VECTOR(1536, FLOAT32) -- Example vector size
);

-- Insert some sample data (vectors would be generated by a model like OpenAI's text-embedding-ada-002)
-- For brevity, we'll imagine the vectors are populated here.

-- Now, create a HYBRID vector index
CREATE VECTOR INDEX product_hybrid_idx ON product_descriptions (description_vector)
  ORGANIZATION HYBRID
  PARAMETERS ('METADATA_TABLES(description_meta)');

-- The METADATA_TABLES clause links to the text index on the description column
CREATE INDEX product_text_idx ON product_descriptions(description) INDEXTYPE IS CTXSYS.CONTEXT;

-- Now, perform a hybrid search
-- We are looking for products similar to 'powerful and portable laptop'
SELECT
  id,
  description,
  VECTOR_DISTANCE(description_vector, text_to_vector('powerful and portable laptop'), COSINE) as distance,
  SCORE(1) as text_score
FROM
  product_descriptions
WHERE
  -- The VECTOR_COMPARE function now includes a text search component
  VECTOR_COMPARE(
    description_vector,
    text_to_vector('powerful and portable laptop'),
    'CTX_SEARCH(description, ''powerful and portable laptop'', ''score_by_relevance'')',
    'weight(0.4 * text_score + 0.6 * vector_score)', -- Weighting text and vector scores
    10, -- Return top 10 results
    COSINE
  )
ORDER BY
  -- Order by the combined, weighted score
  VECTOR_COMPARE_SCORE() DESC;

				
			

Sessionless Transactions: Decouple Your Application Logic

This is arguably one of the most significant new features for application architecture.

				
					SQL


--[Session 1: Application Server]
-- Initiates the transaction and suspends it after inserting the initial order status.

DECLARE
  v_tx_handle VARCHAR2(128);
BEGIN
  -- Begin a new transaction
  DBMS_DATABASE.BEGIN_TRANSACTION;

  -- Insert the initial order record
  INSERT INTO orders (order_id, status, order_date) VALUES (123, 'PENDING_PAYMENT', SYSDATE);

  -- Suspend the current transaction and get the handle
  v_tx_handle := DBMS_DATABASE.SUSPEND_TRANSACTION;

  -- Now we can close this session. The transaction is safely suspended.
  -- The application would now call the external payment gateway API with the transaction handle.
  -- For this example, we'll just print the handle.
  DBMS_OUTPUT.PUT_LINE('Transaction Suspended. Handle: ' || v_tx_handle);

END;
/

-- At this point, Session 1 is closed. The database connection is released.
-- Some time later, the payment gateway sends a callback to our system.

--[Session 2: Callback Processor]
-- A different process receives the callback and resumes the transaction to complete it.

DECLARE
  v_tx_handle VARCHAR2(128) := '... a_very_long_transaction_handle ...'; -- The handle from the previous step
BEGIN
  -- Resume the transaction using the handle
  DBMS_DATABASE.RESUME_TRANSACTION(v_tx_handle);

  -- The transaction context is now restored.
  -- We can now update the order status.
  UPDATE orders SET status = 'PAYMENT_CONFIRMED' WHERE order_id = 123;

  -- Commit the now-completed transaction
  COMMIT;

  DBMS_OUTPUT.PUT_LINE('Transaction for Order 123 Resumed and Committed.');

END;
/

				
			

Simplified JSON Handling with JSON Collection Views

Oracle continues to enhance its native JSON capabilities. JSON Collection Views are a new type of read-only view that makes it much simpler to query and analyze collections of JSON objects stored within a column. They essentially project the objects in a JSON array into a relational, row-like structure.
				
					SQL


-- Create a table to store sensor data
CREATE TABLE sensor_logs (
    device_id VARCHAR2(50) PRIMARY KEY,
    readings JSON
);

-- Insert a log with multiple readings in a JSON array
INSERT INTO sensor_logs (device_id, readings)
VALUES (
    'thermo-01',
    '{"readings": [
        {"timestamp": "2025-06-18T14:10:00Z", "temperature": 22.5, "humidity": 55},
        {"timestamp": "2025-06-18T14:11:00Z", "temperature": 22.6, "humidity": 54},
        {"timestamp": "2025-06-18T14:12:00Z", "temperature": 22.7, "humidity": 56}
    ]}'
);

-- Create a JSON Collection View to easily query the readings
CREATE JSON COLLECTION VIEW sensor_readings_view FOR sensor_logs.readings.readings
COLUMNS (
    device_id VARCHAR2(50) PATH '$.deviceId', -- Correlate with the base table
    reading_time TIMESTAMP WITH TIME ZONE PATH '$.timestamp',
    temperature NUMBER PATH '$.temperature',
    humidity NUMBER PATH '$.humidity'
);


-- Now, query the view just like a regular relational table!
-- Find all readings where the temperature was above 22.6
SELECT
    device_id,
    reading_time,
    temperature
FROM
    sensor_readings_view
WHERE
    temperature > 22.6;

				
			

Conclusion

Oracle Database 23.6 is a feature-rich release that directly addresses the needs of modern developers. The advancements in AI Vector Search, the architectural flexibility offered by Sessionless Transactions, and the simplified querying with JSON Collection Views provide powerful new patterns for building sophisticated applications.

At MillionLogics, we believe that mastering these tools can significantly accelerate development cycles and unlock new possibilities. We encourage our fellow developers to download the Oracle Database 23.6 Free edition and start experimenting with these exciting new features today.

Explore Our Latest Blogs

Stay Informed with Our Latest Insights

Be the First to Know!

Subscribe to our blogs and stay updated with the latest tech trends, insights, and industry news directly in your inbox.