PLSQL Conditional Compilation

The conditional compilation feature allows selective inclusion/exclusion of PLSQL code based database version. The example below shows setting of PLSQL_CCFLAGS flag. This was introduced in Oracle 10.2 (10gR2) version. The database features such as "COMMIT WRITE IMMEDIATE NOWAIT" can be used in the code when executed in 10gR2 and higher or reverted back to "COMMIT" when executed in earlier versions. This feature is also useful in PLSQL code debugging and tracing when code is executed in development environment and hiding/disabling it when executed in production.

ALTER SESSION SET PLSQL_CCFLAGS='debug_mode:true';

BEGIN
   $IF $$debug_mode $THEN dbms_output.put_line('DEBUGGING ON');
   $ELSE dbms_output.put_line('DEBUGGING OFF');
   $END
END;
/



ALTER SESSION SET PLSQL_CCFLAGS='debug_mode:false';



Use of PLSQL Conditional Compilation In Debugging

Back

Oracle registered trademark of Oracle Corporation.
Last Revised on: November 03, 2013

  1322