Oracle 10gR2+ conditional PL/SQL Compilation
Examples
Example 1
create or replace procedure p
as
begin
$IF $$debug_code
$THEN
dbms_output.put_line( 'Our debug code' );
dbms_output.put_line( 'Would go here' );
$END
dbms_output.put_line( 'And our real code here' );
end;
/
alter procedure P compile
plsql_ccflags = 'debug_code:true' reuse settings
/
Example 2
create or replace procedure p2
as
begin
$if $$plsql_debug
$then
$error 'This program must be compiled with PLSQL_DEBUG disabled' $end
$end
dbms_output.put_line( 'This is where it happens!' );
end;
/
Procedure created
ALTER SESSION SET PLSQL_DEBUG=TRUE
/
alter procedure p2 compile
/
Warning: Procedure altered with compilation errors.
show err
Errors for PROCEDURE P2:
LINE/COL ERROR
-------- -----------------------------------------------------------------
6/5 PLS-00179: $ERROR: This program must be compiled with PLSQL_DEBUG
disabled
Source:
- http://www.oracle.com/technetwork/database/features/plsql/overview/plsql-conditional-compilation-133587.pdf
- Oracle 10gR2 – Conditional PL/SQL Compilation – AMIS Oracle and Java Blog
Related Posts
Subscribe
Connect withD
Login
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Connect withD
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
0 Comments
Inline Feedbacks
View all comments