EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Software Development Software Development Tutorials PL/SQL Tutorial PL/SQL Unwrapper
 

PL/SQL Unwrapper

Updated April 5, 2023

PL/SQL Unwrapper

 

 

Definition of PL/SQL Unwrapper

PL/SQL provides different kinds of functionality to the user, in which that unwrapper is the one of functionality that is provided by the PL/SQL. Sometimes we need to hide the code from the end-user, so SQL developers wrap the code, and that means it hides the functionality from the user because of security reasons. There are conditions where you wish to examine the wellspring of a wrapped PL/SQL bundle, technique, or capacity. By using PL/SQL unwrapped, we can easily find out the migration error, or we can say that we can find the root cause faster as compared to other processes.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Syntax:

exec unwrap_r('specified sql file name');

Explanation

In the above example, we use the exec unwrap_r command to unwrap the wrap PL/SQL procedure. After that, inside the bracket, we need to write the PL/SQL file name, or we can say that actual file name.

How Unwrapper works in PL/SQL?

Now let’s see how unwrapper works in PL/SQL as follows.

In 10g, the reasonable content PL/SQL is scrambled in an accompanying way. The content is first compacted utilizing the Lempel-Ziv calculation, and a SHA1 hash is produced from the packed information. This hash is then duplicated to a cradle, and the packed information is connected as far as possible. Then, at that point, the worth of every byte in the support is utilized as a record into a person replacement table. This table is likely viewed as an Oracle proprietary advantage, so we will shun posting it here – at the very least it is, in any case, simple to discover in parallel. The subsequent code text is then base64 encoded. Opening up the scrambled code is the opposite. In the first place, its base64 was decoded. Then, at that point, every bite is reconstituted with a second relating replacement table. Last, the content is decompressed, leaving the reasonable content of the PL/SQL.

Oracle 9i and prior utilizes a completely extraordinary technique from 10g for wrapping PL/SQL. You saw before that PL/SQL has its foundations in ADA. At the point when the code is enclosed by 9i, it is changed over to DIANA, which represents Descriptive Intermediate Attributed Notation for ADA. One of the plan goals of DIANA was that it would hold the construction of the first source and be completely reversible. In any case, since the opening up and troubleshooting measure is still somewhat awkward for a progression of PL/SQL bundles, the question arrives “Wouldn’t it be pleasant if we would open up PL/SQL bundles straightforwardly in SQL Developer?” and the answer to this question is addressed as yes.

Examples

Now let’s see different examples of unwrapped in PL/SQL for better understanding as follows. First, we need to create the procedure file, which means we need a .sql extension file as follows.

CREATE OR REPLACE FUNCTION W_SUM(P_INT1 PLS_INTEGER, P_INT2 PLS_INTEGER)
RETURN NUMBER
IS
BEGIN
RETURN P_INT1 + P_INT2;
END;
/

Explanation

In the above example, we try to create the function to make the addition of two numbers. Here we initialize the two variables with integer data types such as P_INT1and P_INT2 with integer data types as shown in the above procedure. After that, we make the addition of two numbers and return the sum of numbers. Here we created a very simple function. The final result of the above PL/SQL function we illustrated by using the following screenshot as follows.

PL SQL Unwrapper 1

PL/SQL executed successfully now saves this procedure on system location with .sql extension file as shown in below screenshot as follows.

PL SQL Unwrapper 2

Now wrap this file by using the command as follows.

First, we need to search file location. After that, we need to execute the following statement as follows.

warp iname=sum_wra.sql

Explanation

In the above example, we use the wrap command with the name keyword as shown; after that, we need to write the file name that we need to wrap. The final result of the above command we illustrated by using the following screenshot as follows.

PL SQL Unwrapper 3

Let’s see in the above screenshot after the wrap command; it created a new object file that sum_wra.plb as shown. As shown in the following screenshot as follows.

PL SQL Unwrapper 4

After the creation of the object file, now we are able to see the wrap code as follows.

CREATE OR REPLACE FUNCTION W_SUM wrapped
a000000
b2
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
8
6b 8d
d/suNDJVKFD2pnITc040umb3WyQwg8eZgcfLCNL+XufQKMuBPefj/tKZf8Pnpb05f3FVTNb1
jt3gYIXg7HE14qhrNT+eP2u83OI1cUGvcdziuUE/fDhNPoNpOzxx4j/RPHSmDB92Jg==
/

Explanation

In the above wrap code, we can only see the function name that means we hide the actual data code of the function from the user. This warp code we executed as per our requirement; the only difference is that here the user cannot interact with code; it only shows the output that means the desired result we will get without any changes.
Now let’s see how we can unwrap this wrap code as follows.
Basically, there are two ways to unwrap the code as follows.

1. Firstly, we just need to right-click in our code and click on the unwrap command. For this command, first, we need to install the PL/SQL unwrapper package on our oracle SQL developer.
After right click shows the unwrap command as shown in the following screenshot as follows.

output

Now just click on the unwrap command. The final result of the unwraps command is shown in the following screenshot as follows.

output 1

2. In the second, we can directly use an online tool to unwrap the code. Here we will see how we can unwrap code by using the online tool as follows.
In the online tool, we need to copy the wrapped code and click on the unwrap button. After completing the execution, it shows the result as shown in the following screenshot as follows.

output 2

Conclusion

We hope from this article you learn PL/SQL unwrapper. From the above article, we have learned the basic syntax of the unwrapped, and we also see different examples of the unwrapped. From this article, we learned how and when we use PL/SQL unwrapper.

Recommended Articles

We hope that this EDUCBA information on “PL/SQL Unwrapper” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. PL/SQL GROUP BY
  2. PL/SQL to_DATE
  3. PL/SQL Cursor Loop
  4. PL/SQL Date Functions

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW