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_AIpackage
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:
- Installing the Oracle
DBMS_CLOUDpackages (not preinstalled in our Free container). - Configuring an Oracle SSL wallet and network ACL permissions.
- Creating an AWS IAM user with Bedrock permissions.
- Storing AWS credentials securely in Oracle.
- Creating a
DBMS_CLOUD_AIprofile 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
