Learn how to use Regex Search to identify deprecated APIs in Oracle APEX – and make sure to resolve potential problems before they arise.
I recently wrote a story on deprecated APEX APIs, where I wrote the following sentence: “You have to make proactive steps to resolve [deprecated APEX APIs].”
So, how do you spot that you’re using deprecated features so that you can be proactive? The Advisor is not advising, and there is no such Utilities \ Resolve Deprecated Features option in APEX.
In this guide, I provide regexes (regular expressions) and instructions that’ll allow you to search for deprecated API usage across your APEX Apps and Repository.
Searching your APEX applications
1. Log in to your APEX Workspace
2. (optional) Click on an App you wish to search
3. Click on the Search box (or press CTRL+’)
4. Copy the text below and paste it into the Search box
regexp:(apex_background_process.abort)|(apex_css.add_3rd_party_library_file)|(apex_custom_auth.logout)|(apex_debug.log_message)|(apex_exec.execute_web_source)|(apex_exec.open_web_source_dml_context)|(apex_exec.open_web_source_query)|(apex_exec.purge_web_source_cache)|(apex_ir.get_report)|(apex_javascript.add_3rd_party_library_file)|(apex_page.get_ui_type)|(apex_page.is_desktop_ui)|(apex_util.get_application_status)|(apex_util.get_build_option_status)|(apex_util.get_global_notification)
This is the first of two regexes you have to use due to the lovely ORA-12733: regular expression too long error.
5. The screen will look super messy after pasting the string in:
6. If you look for the floaty-badge thingy on the right-hand side, hovering over the results, it’ll say Ctrl+3 or Ctrl+2
7. Click it or use the Ctrl+3 or Ctrl+2 keyboard shortcut for the one you want:
- Ctrl+3 = Search Current Application
- Ctrl+2 = Search All Applications
8. It’ll now start searching. When it’s finished, it will return all the results with the deprecated APIs:
9. Click the View button on each result and find an alternative approach
10. When you’re finished, you’ll have to start again with the second Regex below:
regexp:(apex_util.ir_clear)|(apex_util.ir_delete_report)|(apex_util.ir_delete_subscription)|(apex_util.ir_filter)|(apex_util.ir_reset)|(apex_util.public_check_authorization)|(apex_util.reset_authorizations)|(apex_util.set_app_build_status)|(apex_util.set_application_status)|(apex_util.set_build_option_status)|(apex_util.set_current_theme_style)|(apex_util.set_global_notification)
However, this time you can paste it directly into the search box here:
Analyze the results similarly to steps 5-9 to find all your deprecated APIs.
Searching your repository
For this part of the blog, I’m using a test repository pretius-apex-lifecycle-aligned-sample-customers, a derivative work of the APEX Sample Customers Application.
1. Open your repository in VSCode
2. Click on the search icon 🔎 in the side panel
3. Click the rectangle/star icon to select regular expressions (see picture below)
4. In files to include select your source code folder. I’m selecting ./src/
5. In the search box, paste in the following (this regex combines the two above, as VSCode has no problem with long search strings):
regexp:(apex_background_process.abort)|(apex_css.add_3rd_party_library_file)|(apex_custom_auth.logout)|(apex_debug.log_message)|(apex_exec.execute_web_source)|(apex_exec.open_web_source_dml_context)|(apex_exec.open_web_source_query)|(apex_exec.purge_web_source_cache)|(apex_ir.get_report)|(apex_javascript.add_3rd_party_library_file)|(apex_page.get_ui_type)|(apex_page.is_desktop_ui)|(apex_util.get_application_status)|(apex_util.get_build_option_status)|(apex_util.get_global_notification)|(apex_util.ir_clear)|(apex_util.ir_delete_report)|(apex_util.ir_delete_subscription)|(apex_util.ir_filter)|(apex_util.ir_reset)|(apex_util.public_check_authorization)|(apex_util.reset_authorizations)(apex_util.set_app_build_status)|(apex_util.set_application_status)|(apex_util.set_build_option_status)|(apex_util.set_current_theme_style)|(apex_util.set_global_notification)
6. The results will be shown below:
7. Click each result to open the file (or drag the result to the right to open)
8. Enjoy!
Conclusion
And that’s about it. With this, you should be able to identify any deprecated API used in your Oracle APEX app to take proactive steps and resolve the problem before it arises. If you have any questions, reach out to me at mmulvaney@pretius.com. And if you’re interested in APEX-related content, check out the other articles on our blog:
- Oracle APEX tutorial: Uncover Oracle’s best-kept low-code secret
- Oracle APEX new features – the low-code platform keeps evolving
- Oracle APEX for public apps – Here’s why it’s the perfect choice
- Oracle VBCS vs APEX: Use scenarios, differences, and similarities
- Oracle APEX Testing with Chrome Recorder, Puppeteer, and Lighthouse Audit