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!

conditional compilation based on database name

S.BovinJan 8 2024 — edited Jan 8 2024

Is it possible to do conditional compilation based on the database name within a P/SQL SELECT ?

Something like this:

begin

SELECT  blah  
  into       blah  
where   A=B

$IF database_name = ‘TRAINING’ $THEN
and XXX = YYY
$END IF
and mickey = mouse;

end;

I know that would do the same thing: (code not optimised, this is just an example)

and ( (select db.name from v$database db) = ‘TRAINING’ and XXX = YYY)
or (select db.name from v$database db) <> ‘TRAINING’
)

however I want to use conditional compilation to minimize the amount of regression testing and performance testing that I would need to do. The change is only applicable to one environment but has to be deployed to all environments due to our version control procedures.

Comments
Post Details
Added on Jan 8 2024
7 comments
526 views