406 days ago I’ve released PL/SQL Unwrapper for SQL Developer version 0.1.1 and blogged about it. With this extension you can unwrap the content of a SQL Developer window. Time for an update. With the new verison 1.0 you can unwrap multiple selected objects with a few mouse clicks. In this blog post I show how.
1. Install Extensions
I assume that you are already using SQL Developer 4.0.2 or higher. If not then it is about time that you grab the latest version from here and install it. It’s important to note that the extensions won’t run in older versions of SQL Developer.
Configure the update centers http://update.salvis.com/ and http://update.oddgen.org/ to install the extensions for SQL Developer:
If you cannot use update center because your company’s network restricts the internet access then download the latest versions and install them from file.
Why download oddgen for SQL Developer? Because the bulk unwrap feature is implemented as oddgen plugin. Unwrapping an editor content works without oddgen, but for bulk unwrap you need oddgen.
2. Setup Test Environment
If you have a schema in your Oracle database with wrapped code you may skip this step and use this schema for bulk unwrap.
For the test environment I’ve used Morten Braten’s Alexandria PL/SQL Utility Library. Clone or download the library from GitHub. To install the library you need a dedicated user. Create such a user as SYS on your Oracle database instance as follows:
CREATE USER ax IDENTIFIED BY ax DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp; ALTER USER ax QUOTA UNLIMITED ON users; GRANT connect, resource TO ax; GRANT execute ON dbms_crypto TO ax;
Then run the install.sql script in the setup directory of the Alexandria PL/SQL Utility Library as user AX.
@install.sql
Wrap the PL/SQL code except package and type specifications in schema AX by running the script wrap_schema.sql:
3. Bulk Unwrap
Start SQL Developer and open a connection as user AX on your database.
If the oddgen window is not visible then select “Generators” from the “View” menu as shown in the following picture:
Afterwards the Generators window appears in the lower left corner within SQL Developer.
Select the open connection in combo box of the Generators window. Open the “PL/SQL Unwrapper” node and the “Package Bodies” node to show all wrapped package body names.
Select some or all package body nodes and press Return to generate the unwrapped code in a new worksheet. Afterwards you just may execute the generated code. Add “SET DEFINE OFF” at the start of the script to ensure unwrapped code containing ampersand (&) characters is processed correctly. Another option is to configure a connection startup script (login.sql) to change the default behaviour.
The following audioless video shows in just 56 seconds the whole bulk unwrapping process in detail.
I hope you find this new feature useful.