DB@AWS · SELECT AI · AMAZON BEDROCK
Bringing AI to Your Data on Oracle Database@AWS: Oracle Select AI with Amazon Bedrock
Share on LinkedIn ↗Next: Build the supervisor led AR and AP agent team
You’ve provisioned the database. What’s next? Let’s bring AI to the data.
With Oracle Autonomous Database running on Oracle Database@AWS, the next step is to connect it to Amazon Bedrock and ask questions in plain English.
This walkthrough shows how to connect Oracle Select AI to Amazon Bedrock, explore invoice data, and add business context through table and column comments. Follow the steps to generate SQL, execute queries, explain their logic, and describe results in plain English.
What will you achieve?
Ask a business question in plain English, inspect the generated SQL, and verify the result. First establish the correct overdue-invoice answer with reference SQL, then repeat the question with business comments enabled.
Autonomous Database calls Amazon Bedrock over a private connection. SQL Developer provides the interface for the examples.

Before you begin
Use an existing Autonomous Database private endpoint, an application VPC connected through ODB peering, and a Systems Manager managed EC2 client. Keep the existing wallet and TLS settings for SQL Developer. You also need permission to configure the Bedrock endpoint, scoped IAM access, database host ACLs and the associated VCN’s private DNS.
| Component | Name or setting used |
|---|---|
| Database connection | ADBSLAB01 as ADMIN |
| Table | ADMIN.AR_INVOICES_DEMO |
| Region | us-east-1 |
| Model | Amazon Nova Lite, amazon.nova-lite-v1:0 |
| AI profile | BEDROCK_BASELINE |
| Oracle credential | AWS_BEDROCK_CRED |
| Bedrock endpoint | odb-select-ai-bedrock-runtime |
| Conversation | false |
Use your deployment’s identifiers and private addresses in place of the example names. Bedrock inference and interface endpoints incur charges.
1. Start EC2 and the database and connect from Windows
SQL Developer connects to Autonomous Database through an EC2 client and an AWS Systems Manager port-forwarding tunnel.
For the infrastructure walkthrough, see Building Oracle Database@AWS with Terraform and GitHub Actions. This article continues from that running lab.
Open the database tunnel from Windows
Start the existing EC2 client and wait for both Running and Systems Manager Online. Start Autonomous Database and wait for Available. If either is already running, continue without restarting it.
Create adbs-tunnel.json with your actual database private endpoint IP:
{
"host": ["YOUR_DATABASE_PRIVATE_ENDPOINT_IP"],
"portNumber": ["1522"],
"localPortNumber": ["1522"]
}
Run this in Windows PowerShell using an authenticated AWS profile:
aws ssm start-session --target YOUR_EC2_INSTANCE_ID --profile YOUR_PROFILE --region us-east-1 --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters file://adbs-tunnel.json

In SQL Developer, connect using the saved wallet and TLS configuration and verify the session:
SELECT SYS_CONTEXT('USERENV', 'SESSION_USER') AS session_user,
SYSTIMESTAMP AS database_time
FROM dual;

2. Configure Amazon Bedrock access
Choose a Bedrock model, create a dedicated AWS identity, and store its key in an Oracle credential.
Select the model and Region
-
Open Amazon Bedrock in US East (N. Virginia), us-east-1.
-
Choose Model catalog, search for Amazon Nova Lite, and open its details.

-
Confirm the API model ID is
amazon.nova-lite-v1:0and that it is supported in the selected Region. -
Use this exact model ID in the IAM policy, endpoint policy and AI profile.
The former Model access page has been retired. Model activation requirements vary by provider and account; use the catalog and complete applicable prerequisites. An invocation is needed to establish access. AWS model access documentation

Create the scoped IAM policy
Open IAM → Policies → Create policy → JSON. Paste the following policy, choose Next, name it odb-select-ai-bedrock-nova-lite-invoke, review it, and choose Create policy.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1::foundation-model/amazon.nova-lite-v1:0"
}]
}
Use your administrator session to create this policy. The database identity needs only the scoped invocation permission. AWS IAM policy examples

Create a dedicated IAM user
-
Open IAM → Users → Create user.
-
Enter
odb-select-ai-bedrock-lab. -
Leave Provide user access to the AWS Management Console unchecked.

-
Choose Next, then Attach policies directly.
-
Search for and select
odb-select-ai-bedrock-nova-lite-invoke. -
Continue to Review and create, verify the name and selected policy, then choose Create user.
-
Open the user’s Permissions tab and confirm the scoped Nova Lite policy is attached.

Generate an access key
Open the user’s Security credentials tab. Under Access keys, choose Create access key.


Add a description such as Oracle Autonomous Database Select AI — Nova Lite us-east-1 to identify the key’s purpose.

Choose Create access key, save the access key ID and secret privately, then choose Done. Enter them only in the hidden prompts below; do not include the retrieval screen in the article.
Store the key in an Oracle credential
Store the access key ID as the credential’s username and the secret access key as its password.
Run this script with F5 in SQL Developer as ADMIN. Enter the saved access key ID and secret only in the hidden prompts. Create the credential once; if it already exists, verify its name instead of recreating it.
SET ECHO OFF
SET VERIFY OFF
SET DEFINE ON
ACCEPT bedrock_access_key CHAR PROMPT 'Bedrock AWS access key ID: ' HIDE
ACCEPT bedrock_secret_key CHAR PROMPT 'Bedrock AWS secret access key: ' HIDE
BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'AWS_BEDROCK_CRED',
username => '&bedrock_access_key',
password => '&bedrock_secret_key');
END;
/
UNDEFINE bedrock_access_key
UNDEFINE bedrock_secret_key
SELECT credential_name
FROM user_credentials
WHERE credential_name = 'AWS_BEDROCK_CRED';

Create the Bedrock Runtime endpoint
Create an interface endpoint in the application VPC so the database can reach Bedrock privately through the existing ODB peering connection. Follow the endpoint creation form in this order.
AWS documents the com.amazonaws.<region>.bedrock-runtime interface endpoint and regional DNS behavior. The database-side DNS and peering must also be configured for this cross-network deployment. Bedrock private connectivity
How the private connection works

The database sends HTTPS directly through ODB peering to the Bedrock interface endpoint. EC2 carries only the SQL Developer tunnel.
1. Choose the endpoint service
In the AWS Console, select us-east-1, then open VPC → Endpoints → Create endpoint. Enter odb-select-ai-bedrock-runtime as the name. Choose AWS services, search for bedrock-runtime, and select com.amazonaws.us-east-1.bedrock-runtime.

2. Choose the VPC and subnet
Under Network settings, choose network-01-vpc, the application VPC connected to the ODB network. Keep Enable private DNS name selected and use IPv4.

Under Subnets, select the application subnet in us-east-1d. The endpoint will create its network interface in this subnet.

3. Select the endpoint security group
Keep the endpoint creation form open. If the security group does not exist yet, create it in a separate tab, then return to select it.
Create the security group separately
Open VPC → Security groups → Create security group. Enter odb-select-ai-bedrock-endpoint, add a description such as HTTPS access to the Bedrock Runtime endpoint, and choose the same application VPC, network-01-vpc.

Add the inbound HTTPS rule
Under Inbound rules, choose Add rule, set Type to HTTPS (TCP 443), choose Custom as the source type, and enter the database private IP as 10.43.0.6/32. For this example, retain the default outbound rule, then choose Create security group. If the group already exists, add the rule through Edit inbound rules instead.
The database itself sends Select AI requests to Amazon Bedrock over HTTPS (TCP 443). Allow inbound TCP 443 on the Bedrock endpoint’s security group from the database’s private IP—10.43.0.6/32 in this example. The /32 limits the rule to that single address.
Allowing only the EC2 application subnet is insufficient: EC2 carries the SQL Developer tunnel, while the database sends its AI requests directly through ODB peering.


Return to the endpoint form and select the group
In the endpoint form’s Security groups section, refresh the list and select odb-select-ai-bedrock-endpoint (sg-017f71175045729fe in this deployment). Continue to the endpoint policy section.

4. Set the endpoint policy
Under Policy, choose Custom. Allow the dedicated IAM user to invoke the same Nova Lite model configured earlier. Replace YOUR_ACCOUNT_ID with your AWS account ID.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::YOUR_ACCOUNT_ID:user/odb-select-ai-bedrock-lab"
},
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:us-east-1::foundation-model/amazon.nova-lite-v1:0"
}]
}
The user’s IAM policy and this endpoint policy must both allow the request.

5. Create the endpoint
Review the service, VPC, subnet, security group and custom policy, then choose Create endpoint. Wait for Available before continuing.

6. Check the return route
After creating the endpoint, open VPC → Subnets, select the endpoint subnet, and follow its Route table link. Under Routes, check that the database client subnet, 10.43.0.0/24 in this deployment, has an Active route through the existing ODB peering connection. This lets replies from the Bedrock endpoint return to the database.

Private DNS must also work from the database network
Enabling private DNS on the AWS interface endpoint makes the regional service name resolve privately within the associated VPC. That setting alone does not establish the DNS mapping used by the database in its associated OCI VCN.
Map bedrock-runtime.us-east-1.amazonaws.com to the endpoint network interface’s private IP in the database VCN’s private DNS view. This deployment uses TTL 60; update the record if the endpoint address changes.
In OCI, open the database VCN’s associated private view and create a private zone named bedrock-runtime.us-east-1.amazonaws.com. Select the existing VCN-network-01 private view for this deployment.

Choose Create and open the zone details.

Under Records → Manage records, add an apex A record for the zone hostname using the Bedrock endpoint network interface’s private IP and TTL 60, then review and publish it. The final configuration uses 10.40.0.220. Use your deployment’s endpoint address.

Keep the regional hostname in API requests for TLS and AWS request signing.
The working configuration used ODB peering and the interface endpoint. VPC Lattice resources explored during troubleshooting are not required for this path. The two existing OCI network security groups remained unchanged, and no database restart was required.
Create the Select AI profile
Create the profile once using the credential and model configured above. Comments are enabled later for the comparison. If BEDROCK_BASELINE already exists, inspect it before rerunning CREATE_PROFILE.
BEGIN
DBMS_CLOUD_AI.CREATE_PROFILE(
profile_name => 'BEDROCK_BASELINE',
attributes => '{
"provider": "aws",
"credential_name": "AWS_BEDROCK_CRED",
"model": "amazon.nova-lite-v1:0",
"object_list": [
{"owner": "ADMIN", "name": "AR_INVOICES_DEMO"}
],
"conversation": false
}');
END;
/
SELECT profile_name, attribute_name, attribute_value
FROM user_cloud_ai_profile_attributes
WHERE profile_name = 'BEDROCK_BASELINE'
AND LOWER(attribute_name) IN
('provider', 'model', 'object_list', 'conversation', 'comments')
ORDER BY attribute_name;

The object list supplies schema context for SQL generation; database privileges still control access. Each example specifies the profile explicitly.
Test connectivity from the database
Run these checks from the database connection in SQL Developer. Playground and EC2 checks use different callers and network paths.

Check private endpoint routing and host privileges
Read the outbound routing property:
SELECT property_value AS outbound_routing
FROM database_properties
WHERE property_name = 'ROUTE_OUTBOUND_CONNECTIONS';
For this deployment, private endpoint routing was already enabled and remained unchanged. Also inspect the host ACL entries for the schema making the request. The working ADMIN configuration had http and connect on port 443 for the regional Bedrock hostname, and a separate resolve privilege without a port range. The host entries were configured as private targets.
Inspect the matching host ACEs as an administrator:
SELECT host, lower_port, upper_port, principal,
privilege, grant_type
FROM dba_host_aces
WHERE host = 'bedrock-runtime.us-east-1.amazonaws.com'
AND principal = 'ADMIN'
ORDER BY lower_port, privilege;
Review matching entries and any broader rules before changing them. A missing privilege must be corrected for the actual calling schema and private hostname target; the checks here do not alter ACLs.
Host ACLs permit the database schema to make requests; the endpoint security group permits the network connection.
Resolve the hostname inside Autonomous Database
SELECT UTL_INADDR.GET_HOST_ADDRESS(
'bedrock-runtime.us-east-1.amazonaws.com'
) AS database_dns_result
FROM dual;
This checks name resolution from the database session. Compare it with the private DNS configuration described above. In this environment, the database lookup displayed a 254.x.x.x address even with the private DNS mapping configured. That observation alone did not establish whether HTTPS worked, so the next check tested the connection directly.
Request an HTTPS response
Run a simple GET against the regional service root. This is a transport probe, not a signed inference request:
SET SERVEROUTPUT ON
DECLARE
req UTL_HTTP.req;
res UTL_HTTP.resp;
BEGIN
UTL_HTTP.SET_TRANSFER_TIMEOUT(15);
UTL_HTTP.SET_RESPONSE_ERROR_CHECK(FALSE);
req := UTL_HTTP.BEGIN_REQUEST(
'https://bedrock-runtime.us-east-1.amazonaws.com/', 'GET');
res := UTL_HTTP.GET_RESPONSE(req);
DBMS_OUTPUT.PUT_LINE(
'HTTPS status: ' || res.status_code || ' ' || res.reason_phrase);
UTL_HTTP.END_RESPONSE(res);
END;
/
SET_RESPONSE_ERROR_CHECK(FALSE) allows the probe to inspect a 4xx or 5xx response; it does not disable TLS certificate verification. The timeout setting applies to this session’s UTL_HTTP requests.

The HTTP reply confirms a working HTTPS transport path. 404 does not confirm model invocation: the service root is not an inference request.
Invoke the model from the database
After the transport check, use the configured AI profile and stored credential to make an actual model request:
SET LONG 100000
SET LONGCHUNKSIZE 100000
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'Reply with exactly: Database to Bedrock test successful.',
profile_name => 'BEDROCK_BASELINE',
action => 'chat') AS model_response
FROM dual;

The response verifies model invocation using the database profile, stored credential and current permissions. Next, inspect the invoice data.
Interpret failures at the correct layer
| Observation | What to check next |
|---|---|
| ORA-24247 network access denied | Effective host ACL privileges for the calling database schema and hostname. |
| ORA-30699 connection timeout | DNS destination, peering routes, return traffic, security groups and network ACLs. |
| HTTP response from the root URL | Transport is responding; continue with a signed model request. |
| Authorization or model-access error | Credential, IAM policy, endpoint policy, model ID, region and provider prerequisites. |
| Model response | Connectivity and invocation worked for this request; continue to validate business queries separately. |
3. Inspect the invoice table
Inspect AR_INVOICES_DEMO to understand its columns and check for existing table and column comments:
SELECT column_name, data_type, nullable
FROM user_tab_columns
WHERE table_name = 'AR_INVOICES_DEMO'
ORDER BY column_id;
SELECT comments
FROM user_tab_comments
WHERE table_name = 'AR_INVOICES_DEMO';
SELECT column_name, comments
FROM user_col_comments
WHERE table_name = 'AR_INVOICES_DEMO'
AND comments IS NOT NULL
ORDER BY column_name;
Inspect the initial schema and comments before adding business context.

Inspect sample invoices, then group the table by payment status and currency:
SELECT invoice_number, customer_name,
TO_CHAR(due_date, 'YYYY-MM-DD') AS due_on,
currency_code, invoice_amount, paid_amount,
outstanding_amount, payment_status
FROM admin.ar_invoices_demo
ORDER BY invoice_id
FETCH FIRST 5 ROWS ONLY;
SELECT payment_status, currency_code, COUNT(*) AS invoice_count
FROM admin.ar_invoices_demo
GROUP BY payment_status, currency_code
ORDER BY currency_code, payment_status;

| Payment status | Currency | Invoice count |
|---|---|---|
| PAID | USD | 24,927 |
| PARTIALLY PAID | USD | 25,022 |
| UNPAID | USD | 50,051 |
All rows in the observed grouping were USD. Keep currencies separate when aggregating monetary values so that the rule remains valid if the dataset changes.
4. Verify the overdue invoice answer with SQL
An overdue outstanding invoice in this example has a due date before the requested reporting date and an outstanding amount greater than zero. Invoices due on November 16 are excluded from that date’s overdue total. Partially paid invoices are included when a balance remains.
The table contains stored balances, not a payment history. The reporting date controls the due-date cutoff; this query does not reconstruct what the balance was at some earlier point in time.
SELECT '2026-11-16' AS as_of_date,
currency_code,
COUNT(*) AS overdue_invoice_count,
SUM(outstanding_amount) AS overdue_outstanding
FROM admin.ar_invoices_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0
GROUP BY currency_code
ORDER BY currency_code;

5. Generate SQL before adding business context
Use SHOWSQL to inspect the generated query before execution. Keep this prompt unchanged for the before-and-after comparison:
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the overdue invoice count and total outstanding amount as of November 16, 2026 in AR_INVOICES_DEMO?',
profile_name => 'BEDROCK_BASELINE',
action => 'showsql') AS generated_sql
FROM dual;

The generated statement was:
SELECT
COUNT("INVOICE_ID") AS "OVERDUE_INVOICE_COUNT",
SUM("OUTSTANDING_AMOUNT") AS "TOTAL_OUTSTANDING_AMOUNT"
FROM "ADMIN"."AR_INVOICES_DEMO"
WHERE "DUE_DATE" < TO_DATE('2026-11-16', 'YYYY-MM-DD');
Execute the exact returned statement to validate it. A fresh AI request could generate a different query; the comparison below uses the saved SQL.
| Result | Invoice count | Outstanding USD |
|---|---|---|
| Generated SQL without business context | 96,220 | 1,512,705,087.97 |
| Verified business answer | 72,240 | 1,512,705,087.97 |
| Difference | +23,980 | 0.00 |
The amount matched, which could easily have made the result feel trustworthy. But the query counted invoices based only on their due dates. An old due date does not make a fully paid invoice an outstanding receivable.
Successful execution and a matching monetary total do not prove correctness. The invoice count must also satisfy the business definition.
6. Add table and column comments
Add one table comment and descriptions for all 11 columns. Explain which date defines overdue, which amount represents the remaining balance, how partial payments are handled, and why currencies must be grouped.
Comments supply additional schema metadata when enabled in the profile; they do not train or fine-tune Nova Lite. Oracle comment-based SQL generation example
COMMENT ON COLUMN admin.ar_invoices_demo.due_date IS
'Payment due date. Overdue means DUE_DATE < the requested as-of date,
excluding invoices due on that date. Also require OUTSTANDING_AMOUNT > 0.';
COMMENT ON COLUMN admin.ar_invoices_demo.outstanding_amount IS
'Remaining unpaid balance in CURRENCY_CODE. Outstanding invoices require
this value > 0. Sum this column for total outstanding balances,
including partially paid invoices.';
COMMENT ON COLUMN admin.ar_invoices_demo.payment_status IS
'Observed values: PAID, PARTIALLY PAID, UNPAID. Use OUTSTANDING_AMOUNT > 0
to select outstanding invoices; filtering only UNPAID would omit
partially paid invoices.';
Run the attached complete script to add the table comment and all 11 column comments. The excerpt above shows three key columns.

Complete AR invoice business comments SQL
Read back the descriptions from USER_TAB_COMMENTS and USER_COL_COMMENTS:
SELECT 'TABLE' AS object_or_column, comments AS saved_comment
FROM user_tab_comments
WHERE table_name = 'AR_INVOICES_DEMO'
UNION ALL
SELECT column_name, comments
FROM user_col_comments
WHERE table_name = 'AR_INVOICES_DEMO';

Enable comments in the AI profile
Enable comments in the AI profile, then read back the saved setting:
BEGIN
DBMS_CLOUD_AI.SET_ATTRIBUTE(
profile_name => 'BEDROCK_BASELINE',
attribute_name => 'comments',
attribute_value => 'true');
END;
/
SELECT profile_name, attribute_name, attribute_value
FROM user_cloud_ai_profile_attributes
WHERE profile_name = 'BEDROCK_BASELINE'
AND LOWER(attribute_name) = 'comments';
The verified row was BEDROCK_BASELINE | comments | true. Oracle documents this setting as the switch for including table and column comments in SQL-generation metadata. Oracle documentation
7. Repeat the question and compare the results
Repeat the question with the same model and profile. Only the business descriptions and the comments setting have changed.
Repeat the same SHOWSQL call from step 5, with the prompt unchanged:
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the overdue invoice count and total outstanding amount as of November 16, 2026 in AR_INVOICES_DEMO?',
profile_name => 'BEDROCK_BASELINE',
action => 'showsql') AS generated_sql
FROM dual;
This time, Select AI generated:
SELECT
COUNT("INVOICE_ID") AS OVERDUE_INVOICE_COUNT,
SUM("OUTSTANDING_AMOUNT") AS TOTAL_OUTSTANDING_AMOUNT
FROM "ADMIN"."AR_INVOICES_DEMO"
WHERE "DUE_DATE" < TO_DATE('2026-11-16', 'YYYY-MM-DD')
AND "OUTSTANDING_AMOUNT" > 0
AND "PAYMENT_STATUS" IN ('UNPAID', 'PARTIALLY PAID')
GROUP BY "CURRENCY_CODE";

The SQL groups by currency but omits the currency code from its output. Include that code when presenting results across multiple currencies.
Execute the exact returned SQL shown above and compare both measures with the reference:
| Result | Invoice count | Outstanding USD |
|---|---|---|
| Before business comments | 96,220 | 1,512,705,087.97 |
| After business comments were enabled | 72,240 | 1,512,705,087.97 |
| Verified business answer | 72,240 | 1,512,705,087.97 |
| After minus verified | 0 | 0.00 |

For this question and dataset, the added business context produced SQL with the required positive-balance condition and the correct count. Continue to validate each generated query against the reporting rules.
8. Test the five Select AI actions
Explore five actions in SQL Developer, each with a different purpose. SHOWSQL, RUNSQL, EXPLAINSQL and NARRATE use the identical overdue-invoice question; CHAT uses a separate conceptual question.
| Action | Purpose |
|---|---|
| CHAT | Explain a general concept using the model |
| SHOWSQL | Generate SQL for review |
| RUNSQL | Generate and execute SQL against the database |
| EXPLAINSQL | Explain generated SQL logic |
| NARRATE | Query records and describe the results in natural language |
These roles follow Oracle’s Select AI action documentation. Each example below includes its invocation and the observed response.
CHAT explains a concept
Ask CHAT to explain a familiar accounts receivable concept:
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'Explain accounts receivable aging and how partial payments affect outstanding balances. Use a simple numerical example. Keep the answer under 180 words.',
profile_name => 'BEDROCK_BASELINE',
action => 'chat') AS chat_response
FROM dual;

The response correctly described a partial payment reducing a balance. But it also claimed that the payment moves the invoice into a newer aging category. Under the due-date aging convention used here, the remaining balance normally retains its age from the original due date. A payment reduces what is owed; it does not reset that date. The screenshot illustrates how a readable explanation can still contain a business error.
SHOWSQL lets us review the logic
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the overdue invoice count and total outstanding amount as of November 16, 2026 in AR_INVOICES_DEMO?',
profile_name => 'BEDROCK_BASELINE',
action => 'showsql') AS generated_sql
FROM dual;

SHOWSQL returns SQL text for review without executing it.
RUNSQL brings back the answer
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the overdue invoice count and total outstanding amount as of November 16, 2026 in AR_INVOICES_DEMO?',
profile_name => 'BEDROCK_BASELINE',
action => 'runsql') AS runsql_response
FROM dual;

Both returned measures match the reference. RUNSQL makes a fresh generation request; do not assume it executes the same SQL previously returned by SHOWSQL.
EXPLAINSQL explains the generated query
Use EXPLAINSQL to describe the generated SQL in natural language. This explains query logic rather than producing an optimizer execution plan.
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the overdue invoice count and total outstanding amount as of November 16, 2026 in AR_INVOICES_DEMO?',
profile_name => 'BEDROCK_BASELINE',
action => 'explainsql') AS explanation
FROM dual;

Review the generated SQL alongside its explanation. This call introduced the following filter:
AND "OUTSTANDING_AMOUNT" > 0
AND "PAYMENT_STATUS" IN ('PAID', 'PARTIALLY PAID')
The status list omitted UNPAID. It differed from the earlier correct statement, which included UNPAID and PARTIALLY PAID. The explanation then incorrectly described its own filter as excluding fully paid invoices without recognizing the missing unpaid category. This statement was not executed, so no numerical result is claimed for it.
The comments remained enabled during this call. EXPLAINSQL supplies an explanation to review; it does not independently verify the query’s correctness.
NARRATE tells the result in plain English
Use NARRATE to query the records and describe the result in plain English. This action sends query results to the model; the table here contains synthetic invoices.
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'What are the overdue invoice count and total outstanding amount as of November 16, 2026 in AR_INVOICES_DEMO?',
profile_name => 'BEDROCK_BASELINE',
action => 'narrate') AS narrative
FROM dual;

The figures and treatment of partial payments match the reference. The narrative does not explicitly name USD, and its underlying generated SQL was not separately inspected.
Conclusion
Oracle Select AI and Amazon Bedrock provide a practical way to ask questions of data on Oracle Database@AWS. In the verified comparison, business comments corrected an invoice count that was 23,980 too high. The saved context-enabled SQL matched both reference measures, and the observed RUNSQL and NARRATE calls also returned matching figures.
Two errors remain useful checks for readers: CHAT incorrectly described partial payments changing an invoice’s age, and EXPLAINSQL generated a status filter that omitted unpaid invoices. Context improved one verified answer, but fresh calls still varied. This is a worked example, not a general accuracy benchmark.
Define business meaning alongside the schema, review the generated SQL, and compare its results with a trusted reference. Comments provide useful context; database knowledge and validation establish whether the answer is correct.
The same approach can extend to customer balances, aging buckets and charts built from validated results. The examples here demonstrate five Select AI actions in SQL Developer; chart rendering requires a suitable visualization tool. Start with a clear business definition and a verified query before building further analysis.
Troubleshooting and observed limitations
The initial database-to-Bedrock call timed out. Later HTTPS checks and AWS flow logs confirmed connectivity to the interface endpoint. Regional hostname behavior changed after the DNS update; stale resolution was consistent with the delay, but the internal cache was not directly observed.

After connectivity was established, a direct API call rejected the initial Llama 3 70B model because it was a legacy model and the account did not meet its recent-use requirement. Switching to active Nova Lite and updating the scoped IAM policy, endpoint policy and AI profile allowed invocation.
A later SHOWSQL call timed out, while subsequent CHAT and SHOWSQL calls succeeded. The cause of the intermittent timeout remains unresolved.
References
Keep your Oracle notebook growing
Get new Oracle walkthroughs in your inbox, or follow the blog in your favorite RSS reader.
Free email delivery through Blogtrottr. Enter and confirm your email on their site; unsubscribe from any email. The free service may include ads. Your email address is not collected by this blog.
Join the discussion
Ask a question, share a result, or add a useful tip.
Leave a comment
Your name and comment will be public. Keep passwords, email addresses, IP addresses, and other private details out of your comment. Cloudflare Turnstile checks submissions to help prevent spam.