Use AI Keyword to Enter Prompts

Use AI as the keyword in a SELECT statement for interacting with the database using natural language prompts.

The AI keyword in a SELECT statement instructs the SQL execution engine to use the LLM identified in the active AI profile to process natural language and to generate SQL.

You can use the AI keyword in a query with Oracle clients such as SQL Developer, OML Notebooks, and third-party tools, to interact with database in natural language. Note: You cannot run PL/SQL statements, DDL statements, or DML statements using the AI keyword.

Syntax

The syntax for running AI prompt is:

SELECT AI action natural_language_prompt

Parameters

The following are the parameters available for the action parameter:

Parameter Description
showsql Displays the SQL statement for a natural language prompt.
explainsql Explains the generated SQL from the prompt in a natural language. This option sends the generated SQL to the AI provider to produce a natural language explanation.
narrate

The narrate action supports natural language to SQL (NL2SQL).

For NL2SQL, narrate sends the result of a SQL query run by the database to the LLM, which generates a natural language description of that result.

chat

Passes the user prompt directly to the LLM to generate a response, which is provided to the user.

For session-based short-term conversations, if conversation in the DBMS_CLOUD_AI.CREATE_PROFILE function is set to true, this option includes content from prior interactions or prompts, potentially including schema metadata.

For multiple named conversations, only the chat-related prompt histories are sent to the LLM. See Select AI Conversations to learn more..

showprompt

This action supports NL2SQL. This action does not support synthetic data generation, explainsql, and narrate.

Display the constructed prompt that would be sent to the generative AI model.

summarize

Generates a summary of the content for your text and large files using user-specified AI providers. If your AI profile is set in the session then, you can use SELECT AI SUMMARIZE <TEXT>.

See Generate a Summary with Select AI and Example: Select AI Actions to learn more.

If you want to customize the summary generation, use the DBMS_CLOUD_AI.SUMMARIZE function. See Example: Select AI Summarize to learn more.

translate Enables you to use generative AI from the OCI translation service to translate your prompt into the preferred language specified as the target_language attribute in your AI profile.
agent Calls the agent team to process the natural language prompt. See Select AI Agent and Examples of Using Select AI Agent for more details for more details.

To learn how you can use these actions, see Examples of Using Select AI.

Usage Notes