There are many AI assistants to choose from, and one of those is Claude. Claude is a bit unique in that it also is available with LLMs from Anthropic. A one-stop shoppe of sorts, just like MSFT has done with Copilot in VS Code.

I’m using a free Anthropic account along with their desktop application. It allows you to configure MCP Servers, which we just happen to have for Oracle Database.

Once I have this configured, Claude’s LLMs can now access our tools:

  • list-connections
  • connect
  • disconnect
  • run-sqlcl
  • run-sql

Having better object names, comments, etc makes it easier for LLMs to do their job, but…

…LLMs can also help us come up with better object names and comments!

For example, I could ask it to ‘fix’ or improve comments on an existing table, but what if we started with a worst case scenario, a table with NO comments?

Like my Strava table?

Bash
SQL> desc strava

Name             Null?    Type              
________________ ________ _________________ 
ID                        NUMBER(38)        
ACTIVITY_DATE             DATE              
ACTIVITY_NAME             VARCHAR2(100)     
ACTIVITY_TYPE             VARCHAR2(100)     
DESCRIPTION               VARCHAR2(4000)    
ELAPSED_TIME              NUMBER(38)        
DISTANCE                  NUMBER(38)        
COMMUTE                   VARCHAR2(10)      
GEAR                      VARCHAR2(100)     
FILENAME                  VARCHAR2(100)     
COLM_STUFF                VARCHAR2(20)   

I do, and the data is fun…but I have no table comments.

Let’s ask Claude

Claude desktop, using Claude’s Sonnet 4 LLM.

prompt: can you connect to my database and help me optimize the column comments for my Strava table?

Claude: I’ll help you connect to your database and optimize the column comments for your STRAVA table. Let me start by checking what database connections you have available.

I’m going to say, “Allow once” – that means I grant permission for this singular request for the list-connections tool. If we want to do it again, it’ll need to ask for permission, again.

It looks through my connections and finds one it likes, and asks permission to use that to make a database connection.

Same caveat before regarding Allows always vs once.

Really start paying attention now

Once the LLM has access to the database, the LLM will on it’s own, generate SQL code it wants to execute. It will show us this code, alongside the permission request to run it.

I’m going to READ that query. Is it right, does it make sense? Also, the previous prompt to grant access to the database, we always want to make sure we’re in the RIGHT database.

It found my table, saw that it has NO comments. It generated suggested comments for me to review in an editor.

And then it asked me if I wanted to run said code to implement our suggestions.

I can see each SQL statement and the response.

Now that we’re done, I can inspect my table, fully commented –

It had no idea what to do with my ‘COLM_STUFF’ column. I had added that for testing something. Now, I could have fixed the comment myself when it suggested the code, or I could have additionally prompted it to sample the data to get a better idea of what that column (Colm, get it?) does.

We’re not quite done.

Let’s close our connections. Connections are expensive to maintain, so let’s clean up after ourselves.

And, let’s look to see what’s been recorded in the database after our last work session:

Summary Take-aways

You can or you should:

  • use any AI Client that’s MCP compatible, including Claude
  • always review before approving MCP Server tool access
  • execute more than just run SELECT statements
  • see everything you’ve done via MCP with your user via DBTOOLS$MCP_LOG table in your schema

One more thing…

This was too easy!

Ok, let’s make it more challenging.

How about a table with horrible names, the LLM won’t be able to guess or infer much here.

Bash
SQL> info bad_name
TABLE: BAD_NAME 
	 LAST ANALYZED:2025-07-31 19:43:55.0 
	 ROWS         :107 
	 SAMPLE SIZE  :107 
	 INMEMORY     :DISABLED 
	 COMMENTS     : 

Columns 
NAME         DATA TYPE           NULL  DEFAULT    COMMENTS
 ABC         NUMBER(6,0)         Yes              
 DEF         VARCHAR2(20 BYTE)   Yes              
 GHI         VARCHAR2(25 BYTE)   No               
 EMAIL       VARCHAR2(25 BYTE)   No               
 JKL         VARCHAR2(20 BYTE)   Yes              
 MNO         DATE                No               
 PQR         NUMBER(8,2)         Yes              


SQL> select 'good luck with that, Claude!';

So the initial results were only, OK.

But I’m not an idiot, and the LLM is good at taking suggestions.

prompt: How about instead of guessing, we sample the data in the table to see what the columns actually store?

Claude: Excellent idea! That’s much smarter than guessing. Let me sample the actual data in the BAD_NAME table to see what each column contains, which will help us create much more accurate and meaningful comments.

And now it does a MUCH better job with the task at hand.

It asks to run this SQL:

SQL
SELECT /* LLM in use is claude-sonnet-4 */ * FROM BAD_NAME WHERE ROWNUM <= 10

Ok, so it’s going to read the first 10 rows.

I’m not sure about the COLUMN NAMES making much more sense, but it’s able to make sense of what’s IN those columns at least. It also made the jump to EMPLOYEES, so it assume the date field is a HIRE_DATE. Interesting…

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment