APEX Assistant adds AI chat capability to all APEX code editors to assist you with writing SQL queries, debugging code, etc.
Before you can use APEX Assistant, you must create a Generative AI Service and enable the Used by App Builder setting. see my last blog post on how to configure Gen AI service in Oracle APEX using Open AI
To use APEX Assistant, log in to Apex workspace –> Go to the SQL Workshop -> go to SQL Commands and click on APEX Assistant. See my above blog post.
Here you will see APEX Assistant has 2 menu options:
Query Builder - Use Query Builder to get back a simple query.
In Query Builder mode, the AI assumes all questions are in the context of the customer schema in the database. For example, if you request that the AI create SQL for tables that do not exist in the database, APEX Assistant’s responses will not be constructive.
General Assistance - Use General Assistance for general conversation, and technical questions such as “Explain this” or “Improve this code.” In General Assistance mode, APEX Assistant prompts you with default options such as Use Selection, Improve Selection, and Explain Selection.
Let’s see how Query Builder works.
You will see the query is APEX wizard
Type, your message here, enter the average salary of the employee by department name, and click send a message
APEX Assistant responds with a query. This is amazing!
Now you can Run this code to get the result as well if you have this table in your schema.
I would like to show you another best features of APEX assistant which is Chat Widget memory (the context of the chat). For example, I asked how many belong to the department, Given the context in the chat, it already knew I was talking about employees. This is great!
Now Let’s see how General Assistance works:
SELECT ID,
firstname,
lastname,
COUNTRY,
email,
position,
manager
GENDER
FROM customer
WHERE country = 'INDIA'
APEX assistant Improves the query and also corrects the query.
So you can see how interesting is this APEX Assistant which can help in query generation, query correction, and query Improvement.