{"id":96,"date":"2007-04-29T19:20:24","date_gmt":"2007-04-29T18:20:24","guid":{"rendered":"http:\/\/bar-solutions.com\/wordpress\/?p=96"},"modified":"2007-04-30T09:09:16","modified_gmt":"2007-04-30T08:09:16","slug":"conditional-compilation","status":"publish","type":"post","link":"https:\/\/blog.bar-solutions.com\/?p=96","title":{"rendered":"Conditional Compilation&#8230;"},"content":{"rendered":"<p align=\"left\"><a href=\"http:\/\/www.oracle.com\/index.html\" title=\"Oracle 10g, Siebel, PeopleSoft | Oracle, The World&#39;s Largest Enterprise Software Company\" target=\"_blank\">Oracle<\/a> has decided to add <a href=\"http:\/\/download.oracle.com\/docs\/cd\/B19306_01\/appdev.102\/b14261\/fundamentals.htm#BABIHIHF\" title=\"Fundamentals of the PL\/SQL Language\" target=\"_blank\">Conditional Compilation<\/a> to&nbsp;Oracle 10g Release 2. As Bryn Llewellyn states in his white paper <a href=\"http:\/\/www.oracle.com\/technetwork\/database\/features\/plsql\/overview\/plsql-conditional-compilation-133587.pdf\" title=\"Conditional Compilation in Oracle Database 10g Release 2\" target=\"_blank\">Conditional Compilation in Oracle Database 10g Release 2<\/a>: Unusually, but for very compelling reasons, the feature has been made available in patchsets of releases of Oracle Database earlier than the one that introduced the feature. It&nbsp;is available in Oracle 10g Release 1 (10.1.0.4.0) and if you have the right support contract, it can even be turned on Oracle 9i (9.2.0.6).<\/p>\n<p align=\"left\">The idea behind Conditional Compilation is, in my opinion, two (or more) fold. One way to use this is to use new code possibilities in existing packages. Packages that need to run on different versions of the database. Another way to use it, might be to add debug code to your package, which should not be run in a production environment unless there is a problem.<\/p>\n<p align=\"left\">Now, how do you test all this code. For example using <a href=\"http:\/\/www.quest.com\/code-tester-for-oracle\/\" title=\"Quest : Products : Quest&reg; Code Tester for Oracle : Overview\" target=\"_blank\">Quest CodeTester for Oracle<\/a>. In CodeTester it is possible to have only one test set per piece of code. So, what if you want to test both versions of your code (or even more possible versions if you have multiple flags in your code). CodeTester relies on the existing package and it cannot read the &#39;hidden&#39; code. So, if a function becomes private, due to a compiler flag being (un)set, then the test package will become invalid. So, for testing purposes you want all the programs to be visible and you want all the flags turned on that will be turned off in production.<\/p>\n<p align=\"left\">I would like to add a helper package though, in which I can read all the compiler flags and according to the state of those flags execute a test or not. However, there is currently no possibility to enable\/disable tests on this level. There is a setup procedure (and teardown) for every test, but this is a procedure that will be called before the test runs. You also have a possibility to run code before (and after) all the tests are run. What you would want is a &#39;before test&#39; and an &#39;after test&#39; piece of code. This way you would be able to enable\/disable certain testcases depending on the state of parameters (or package variable values). Maybe this will be possible in a future version of the product.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oracle has decided to add Conditional Compilation to&nbsp;Oracle 10g Release 2. As Bryn Llewellyn states in his white paper Conditional Compilation in Oracle Database 10g Release 2: Unusually, but for very compelling reasons, the feature has been made available in patchsets of releases of Oracle Database earlier than the one that introduced the feature. It&nbsp;is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,2,5],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-codetester","category-oracle","category-plsql"],"_links":{"self":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":0,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}