Last active
January 15, 2018 16:47
-
-
Save foobarbaz-pl/72b7dcd85957381108c840f10c31e155 to your computer and use it in GitHub Desktop.
PL/SQL Conditional Compilation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
l_sql varchar2(32767); | |
l_variables varchar2(1000) := ''; | |
l_rac varchar2(50) := 'FALSE'; | |
begin | |
if dbms_utility.is_cluster_database then | |
l_rac := 'TRUE'; | |
end if; | |
l_variables := l_variables || 'RAC:' || l_rac || ','; | |
-- other conditional compilation flags goes here | |
l_variables := rtrim(l_variables, | |
','); | |
dbms_output.put_line(l_variables); | |
l_sql := q'[alter session set PLSQL_CCFLAGS=']' || l_variables || q'[']'; | |
execute immediate l_sql; | |
end; | |
/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create function get_val return varchar2 | |
$if not dbms_db_version.ver_le_10_2 $then | |
result_cache | |
$end; | |
as | |
begin | |
null; | |
$if $$RAC $then | |
-- RAC specific code goes here | |
$end | |
end; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment