Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What does Conditional Compilation does exactly

dhmanMar 3 2020 — edited Mar 4 2020

I have found some code with conditional compilation and I'm trying to figure the usage of it.

Let's assume we have the following:

create or replace package pkg_global_params as
  global_1 constant boolean default TRUE;
  global_2 constant boolean default TRUE;
end;

create or replace procedure test_cond_comp1 as
begin
  if pkg_global_params.global_1 then
    dbms_output.put_line('In');
  else
    dbms_output.put_line('Out');
  end if;
end;

create or replace procedure test_cond_comp1_cond as
begin
  $if pkg_global_params.global_1 $then
    dbms_output.put_line('In');
  $else
    dbms_output.put_line('Out');
  $end
end;

What is the difference with these 2 procedures. I could not find any difference. They both get uncompiled when I change the constant global_1 and none gets uncompiled when I change the global_2.

I read a lot of code but I could not understand what is the different with procedure test_cond_comp1 and  procedure test_cond_comp1_cond.

Can someone explain?

This post has been answered by Paulzip on Mar 3 2020
Jump to Answer
Comments
Post Details
Added on Mar 3 2020
4 comments
243 views