Tuesday, 1 April 2014

HOW TO WRAP THE PLSQL CODE DYNAMICALLY (METHOD1)

As a developer we might not like to keep the source code available for all database users to view and modify. The reason could be to keep copyright of source code or to stop unauthorized changes made within the code. Oracle has provided the WRAP utility to encrypt source code for this purpose. The WRAP utility can be invoked on the operating system, like Windows, command line as it comes with the Oracle client. It can also be invoked within the database using DBMS_DDL package. I have illustrated below how both methods can be used.


STEP1: Write your PLSQL code in Notepad








STEP2:  Save your code as with your user friendly name (LOKANADHAMWRPFILE.SQL)



STEP3:  On the windows command line go to the directory where you saved the file (LOKANADHAMWRPFILE.SQL). Execute the file by following command to wrap the code. it will generate plb file with same name.



STEP4:  Open the DB Instance in Toad, type the below plb file and press F5 Button to execute the Procedure.



STEP5:  To see the wrapped procedure, select the text from the USER_SOURCE view.


.


STEP6:  Call the Procedure either the object working or Not