Voice Command Navigation in Oracle APEX 

Introduction: –
Voice technology is no longer just for virtual assistants like Alexa or Siri—it can now be used inside your Oracle APEX applications to provide hands-free navigation. This trial showcases how we can integrate voice commands to navigate between APEX pages by simply speaking the page name.

The following technologies have been used in voice command navigation in Oracle APEX

  • Oracle APEX
  • Javascript
  • Web Speech API

Why we need to do: –
This feature enables faster navigation without the need for typing or clicking, providing hands-free accessibility for users with physical limitations. It offers a modern user experience by leveraging natural voice interaction, making applications more intuitive and engaging. In large Oracle APEX applications with many pages, it significantly boosts productivity by allowing users to quickly access functions and navigate through the system using simple voice commands.

How do we solve:

Step 1: Create the Button

Create a Button in your page,Set the Button Name to Start_Voice_Command.

Step 2: Function and Global Variable Declaration

In the page’s Function and Global Variable Declaration section

Code

window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
window.recognition = new window.SpeechRecognition();
window.recognition.interimResults = false;
window.recognition.lang = 'en-US';
window.recognition.onresult = function(event) {
const transcript = event.results[0][0].transcript.toLowerCase().trim();
console.log("Heard:", transcript);
// Set transcript in page item
apex.item("P15_TRANSCRIPT_1").setValue(transcript);
 // Call AJAX process to get page number
apex.server.process("GET_PAGE_ID_BY_NAME", {
pageItems: "#P15_TRANSCRIPT_1"
 }, {
success: function(pData) {
if (pData && pData.pageId) {
// Redirect to target page
apex.navigation.redirect("f?p=" + $v("pFlowId") + ":" + pData.pageId + ":" + $v("pInstance"));
} else {
alert("No matching page found for: " + transcript);
}
},
error: function(e) {
console.error("AJAX error:", e);
alert("Something went wrong while retrieving the page.");
}
});
};
window.recognition.onerror = function(event) {
console.error("Speech recognition error:", event.error);
alert("Speech recognition error: " + event.error);
};

Step 3: Create the Dynamic Action for the Button.

Event: Click

Selection Type: Button → Start_Voice_Command

Action: Execute JavaScript Code

Code
recognition.start();

Step 4: Create the AJAX Callback Process.

Code

DECLARE
l_page_id NUMBER;
BEGIN
SELECT page_id
INTO l_page_id
FROM apex_application_pages
WHERE application_id = :APP_ID
AND LOWER(page_name) LIKE '%' || LOWER(:P15_TRANSCRIPT_1) || '%'
AND ROWNUM = 1;
apex_json.open_object;
apex_json.write('pageId', l_page_id);
apex_json.close_object;
EXCEPTION
WHEN NO_DATA_FOUND THEN
apex_json.open_object;
apex_json.write('pageId', to_clob(NULL));
apex_json.close_object;
END;

Conclusion: 

With just four simple steps, we’ve added a voice-based navigation feature to an Oracle APEX app. This proof-of-concept opens up possibilities for voice-controlled dashboards, data entry, and search functionalities—making your applications more accessible, efficient, and futuristic.

Recent Posts