Solving PLS-00753: malformed or corrupted wrapped unit within Apex SQL Workshop
I was working on this great Apex plugin to load Excel sheets with more than 50 columns into the database. And because I had all those great, but secret ideas, to solve all the problems I used a wrapped package to store all the functionality of the plugin.
That worked perfect on my development machine, were I release all the code with SQL*Plus or Toad, but not on apex.oracle.com.
When I uploaded my scripts to the SQL Workshop, and ran it the wrapped script resulted in an error:
Error at line 0: PLS-00753: malformed or corrupted wrapped unit.
Googling this error didn’t help. Oracle advises to run the unwrapped code and wrap it afterwards inside the database, not much of a solution if you want to keep the source secret. But I found this site, which says: “This only happens if the last character of the wrapped code is at the end of a line.” The solution from that side didn’t worked for me, but I started to play with modifying the source of my invalid package.
Running this script after the wrapped script worked for me:
begin execute immediate replace ( dbms_metadata.get_ddl( 'PACKAGE_BODY','DLW', sys_context( 'userenv', 'current_schema' ) ) , ' ' || chr(10) , chr(10) ); end;
Just remove a trailing space of every line. And if you happen to be on an Oracle 10 database and have a large wrapped package, this will work too:
declare t_ddl clob; t_ddl_tab dbms_sql.varchar2s; t_cur integer; begin t_ddl := replace( dbms_metadata.get_ddl( 'PACKAGE_BODY','DLW', sys_context( 'userenv', 'current_schema' ) ) , ' ' || chr(10) , chr(10) ); for i in 0 .. trunc( length( t_ddl ) - 1 ) / 256 loop t_ddl_tab( i ) := substr( t_ddl, 1 + i * 256, 256 ); end loop; t_cur := dbms_sql.open_cursor; dbms_sql.parse( t_cur, t_ddl_tab, 0, t_ddl_tab.last(), false, dbms_sql.native ); dbms_sql.close_cursor( t_cur ); end;
By the way, you can find this great plugin here
- The AMIS Summary of Oracle OpenWorld 2013 is available for download – 60-page white paper
- Het Oracle OpenWorld Preview Evenement (5 september 2013) – 15 sprekers & sessies
- The APEX of Business Value… or: the Business Value of APEX? Cloud takes Oracle APEX to new heights!
- How to build an IM (XMPP) solution with Oracle APEX and Websockets
- Dinsdag 18 september: Oracle Open World & JavaOne 2012 Preview mini-conferenties – 12 presentaties op 1 avond
- Jouw toekomst als Oracle professional AMIS informatieavond over jouw ontwikkelingspad (28 februari)
- Jouw toekomst als Oracle professional – AMIS !!EXTRA!! informatieavond over jouw ontwikkelingspad
- APEX: Make a report row clickable
- OOW 2011 – What's New, Improved and Coming in Oracle Application Development
- Leveraging APEX in XE 11gR2 to rapidly load Excel data into a database table