Hi everyone,
I've been doing some experiments recently, trying to create my own workflow when using AI Agents for coding and how I can use them with Oracle Apex.
While doing a bunch of tests, I thought about something that Apex developers have in common. If you've ever tried to do meaningful version control on an Oracle APEX application, you know the frustration. Export files are long .sql files where all embedded SQL, PL/SQL, JavaScript, HTML, and CSS are packed as encoded string literals inside wwv_flow_imp_page API calls.
Standard diff tools are essentially useless on them. It's very difficult to tell what actually changed between two exports, looking at ids, and api calls with our code defined within a string.
There are some alternatives, like using SQLcl to split the export into different sql files for every page, shared components and processes, but we're still working with sql.
Here is where AI comes handy. I used Claude Code to analyze an actual APEX export file, understand its structure, and iteratively build a Python parser. AI-assisted development is proving to be a powerful approach for this kind of problem, where the format is complex, undocumented, and full of edge cases. Claude Code helped navigate things like escaped quote literals, wwv_flow_string.join decoding, and balanced parenthesis parsing that would have taken much longer to work out manually.
The result is apex_extract, a Python script (3.8+, standard library only) that parses an APEX export and writes per-page, per-type files:
- page_NNNNN_.sql — SQL queries, PL/SQL processes, validations, LOVs, display conditions
- page_NNNNN_.js — Dynamic Action JS, page onload code
- page_NNNNN_.html — static HTML regions
- page_NNNNN_.css — inline CSS
- shared_lovs.sql — shared List of Values
- navigation_map.md — all page-to-page navigation links resolved by source
Usage is straightforward:
python apex_extract.py <exported_app.sql> [output_dir]
No database connection needed, no SQLcl installation required, just Python and your export file. The workflow is simple: export your app, run the script, commit the output to Git. From that point on, git diff tells you exactly what changed between exports.
If you already have a file-based workflow, this might still be useful for auditing exports, documenting an existing app, or onboarding someone new to a codebase. And if you don't have a system yet, this gives you a quick starting point.
This is still experimental, but I'm sure there are edge cases I haven't hit yet, and I'd love feedback from the community. Have you tackled this problem differently? Have you experimented with AI-assisted tooling for APEX development? I'm open to suggestions and contributions.
GitHub: https://github.com/dfreire770/apex_extract
Looking forward to hearing from the community!
Diego Freire