Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Streamline Your Oracle Production Code with Conditional Compilation

Every Oracle PL/SQL developer concerned about the performance impact of repeated if... then... else calls can use conditional compilation to scrub these calls from production code. And that's just the beginning.


advertisement
f you're an Oracle PL/SQL developer, you have two familiar needs:
  1. Include as much debugging code as possible without risking a performance hit when the code is running in production
  2. Create code that takes advantage of the newest features in the latest Oracle Database versions but still runs on older versions—without creating "bloatware" that stuffs the shared pool with separate code for each database version

Developers working in other languages have long had an easy solution that addresses both these needs: the preprocessor or precompiler. For example, the C++ preprocessor can handle conditional compilation directives and string substitution, which allow developers to compile different subsets of the source code for development, production, different DB versions, and so on. But Oracle PL/SQL has been missing this capability—until now.

The recently released Oracle Database10gR2 has a new feature that makes it easy to meet these needs: PL/SQL conditional compilation (CC). PL/SQL CC is not technically a precompiler or preprocessor; it's functionality that Oracle added to the earliest stages of the existing PL/SQL compilation process. The same engine carries it out along with the other stages. However, PL/SQL is sometimes referred to as a preprocessor, as in the name of the DBMS_PREPROCESSOR package (more on that later).



This article shows you how to use Oracle 10gR2's new CC feature, how to view the results of conditional compilation with DBMS_PREPROCESSOR, how to leverage this new feature with DBMS_DB_VERSION to create version-independent code, and how to use conditional compilation to create a lightweight debugging framework.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap