Calling Amazon Bedrock directly from Oracle PL/SQL — with Oracle 26ai Free

Can we call a generative AI model directly from Oracle SQL or PL/SQL, without Python, Java, Lambda, or custom REST API code?

Yes. And we tested it with Oracle AI Database 26ai Free.

Our test environment:

  • Oracle AI Database 26ai Free (23.26.3), running in Docker on AWS EC2
  • Amazon Bedrock in the Frankfurt region (eu-central-1)
  • Amazon Nova 2 Lite model
  • Native Oracle DBMS_CLOUD_AI package

How does it work?

Oracle provides a native AI integration through Select AI and the DBMS_CLOUD_AI PL/SQL package.

Instead of implementing HTTP requests, AWS Signature V4 authentication, and response parsing ourselves, we can define an AI profile and call the model directly from SQL or PL/SQL.

The initial configuration required:

  1. Installing the Oracle DBMS_CLOUD packages (not preinstalled in our Free container).
  2. Configuring an Oracle SSL wallet and network ACL permissions.
  3. Creating an AWS IAM user with Bedrock permissions.
  4. Storing AWS credentials securely in Oracle.
  5. Creating a DBMS_CLOUD_AI profile pointing to the Amazon Nova 2 Lite model.

That’s the infrastructure setup. Once configured, application code becomes remarkably simple.

Why is this interesting for PL/SQL developers?

Existing Oracle applications can integrate generative AI without introducing an additional application server or custom API integration layer.

We can build reusable PL/SQL services for document processing, classification, intelligent forms, booking assistants, and other AI-driven workflows.

Of course, production applications still need proper error handling, security, monitoring, and potentially asynchronous processing with Oracle AQ.

But the fundamental integration already works.

A small but important detail: the AI model does not automatically have access to the Oracle database or real-time information. Database values must be supplied explicitly when needed.

Our actual test — asking Nova 2 Lite for the current date and time:

SELECT DBMS_CLOUD_AI.GENERATE(
    prompt       => 'What is the current date and time?',
    profile_name => 'NOVA2_LITE_EU',
    action       => 'chat'
) AS response
FROM dual;

Actual response from Amazon Nova 2 Lite:

“I don’t have access to real-time data, including the current date and time.”

Exactly the correct answer.

Oracle SQL → Amazon Bedrock → AI response. No custom HTTP implementation.

#OracleDatabase #PLSQL #AmazonBedrock #GenerativeAI #OracleAI

PLslash
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.