Oracle
  Home arrow Oracle arrow Page 4 - Tuning PL/SQL Code
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ORACLE

Tuning PL/SQL Code
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 15
    2007-12-20


    Table of Contents:
  • Tuning PL/SQL Code
  • Optimizing PL/SQL Performance
  • Protecting Stored Code
  • Dynamic Wrapping with DBMS_DDL
  • Guidelines for Working with Wrapped Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Tuning PL/SQL Code - Dynamic Wrapping with DBMS_DDL
    ( Page 4 of 5 )

    Oracle Database 10g Release 2 provides a way to wrap code that is generated dynamically: the WRAP and CREATE_WRAPPED programs of the DBMS_DDL package:

    DBMS_DDL.WRAP
      
    Returns a string containing an obfuscated version of
       your code

    DBMS_DDL.CREATE_WRAPPED
      
    Compiles an obfuscated version of your code into the
       database

    Both programs are overloaded to work with a single string and with arrays of strings based on the DBMS_SQL.VARCHAR2A and DBMS_SQL.VARCHAR2S collection types. Here are two examples that use these programs:

    • Obfuscate and display a string that creates a tiny procedure:

        SQL> DECLAR E
          2    
      l_program   VARCHAR2 (32767);
          3  
      BEGIN
          4    
      l_program := 'CREATE OR REPLACE PROCEDURE dont_look IS BEGIN NULL; END;';
          5    
      DBMS_OUTPUT.put_line (SYS.DBMS_DDL.wrap (l_program));
          6 
      END;
          7 /
        CREATE OR REPLACE PROCEDURE dont_look wrapped

       
      a000000
        369
        abcd
        ....  
        XtQ19EnOI8a6hBSJmk2NebMgPHswg5nnm7+ fMr2ywFy4CP6Z9P4I/v4rpXQruMAy/tJepZmB 
        CC0r
        uIHHLcmmpkOCnm4=
       
    • Read a PL/SQL program definition from a file, obfuscate it, and compile it into the database:

        /* File on web: obfuscate_from_file.sql * /
        CEATE OR REPLACE PROCEDURE obfuscate_from_file (
          dir_in   IN   VARCHAR2
       
      , file_in  IN   VARCHAR2
        )
        IS
          
      l_file   UTL_FILE.file_type;
           l_lines  DBMS_SQL.varchar2s;

          
      PROCEDURE read_file (lines_out IN OUT NOCOPY DBMS_SQL.varchar2s)
           IS BEGIN ... not critical to the example ... END read_file;
        BEGIN
           read_file (l_lines);
           SYS.DBMS_DDL.create_wrapped (l_lines, l_lines.FIRST, l_lines.LAST);

        END obfuscate_from_file;



     
     
    >>> More Oracle Articles          >>> More By O'Reilly Media
     

       

    ORACLE ARTICLES

    - Oracle's Turn to Play in the Sun
    - Implementing and Using Oracle`s Restore Poin...
    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek