Monday, October 15, 2018

Export from APEX 5.1 after you have upgraded to APEX 18.2

I just wrapped up an upgrade for one of the development environments from APEX 5.1 to APEX 18.2 when the phone rang:

I need to export some changes I was doing in APEX 5.1, an issue has suddenly changed from low priority to high priority. The work in only in DEV, and I don't have a recent export!!  Is APEX 18.2 backwardly compatible with APEX 5.1?
 I wouldn't like to try exporting from APEX 18.2 back to APEX 5.1 - that's fraught with danger.
But it is possible to do an export from an old APEX schema provided you haven't dropped the schema, here's how..

variable name     varchar2(255)
variable contents clob
    l_files apex_050100.wwv_flow_t_export_files;
    l_files   := apex_050100.wwv_flow_export_api.get_application(p_application_id => &APPLICATION_ID. );
    :name     := l_files(1).name;
    :contents := l_files(1).contents;
set feed off echo off head off flush off termout off trimspool on
set long 100000000 longchunksize 32767
col name new_val name
select :name name from sys.dual;
spool &name.
print contents
spool off
Surprisingly easy!!!
So now the developer imports the application into the TEST environment, which is still APEX 5.1, finalizes the change and make an emergency release to promote to UAT and PROD.


Juergen Schuster said...

Great finding :-)

Pierre Yotti said...

Great infos. All information are available in Package wwv_flow_export_api in APEX Schema. In the same way, you can export the Workspace or the Feedback for old APEX Version

omabove said...

Check out my article for Grey Market Premium of MTAR IPO GMP - Grey Market Premium