Compiling invalid PL/SQL code without fixing it?
This is just demonstration how to compile invalid package body with minor errors without fixing code.You should always write correct code which will compile.Big what if you cannot see code ( wrapped or not your code and protected ) but you need to compile that package .
Over the years I noticed that most package compilation errors are due to mismatch of specification and definition in the body.
Here is demo:
SQL> create or replace package crap as
procedure ifailed (a in varchar2, b number);
end crap;
/
Package created.
SQL> show errors
No errors.
SQL> create or replace package body crap as
procedure ifailed (a in varchar2 default 2, b number default 3) is
begin
null;
end ifailed;
end crap;
/ 2 3 4 5 6 7
Warning: Package Body created with compilation errors.
SQL> show errors
Errors for PACKAGE BODY CRAP:
LINE/COL ERROR
——– —————————————————————–
2/25 PLS-00593: default value of parameter “A” in body must match that of spec
2/50 PLS-00593: default value of parameter “B” in body must match that of spec
Now I am going to use oracle event 10932 which will disable some of the PL/SQL checking Oracle performs during compilation:
SQL> alter session set events = ’10932 trace name context level 32768′;
Session altered.
SQL> create or replace package body crap as
procedure ifailed (a in varchar2 default 2, b number default 3) is
begin
null;
end ifailed;
end crap;
/
Package body created.
SQL> select object_type,status from dba_objects where object_name=’CRAP’;
OBJECT_TYPE STATUS
——————- ——-
PACKAGE BODY VALID
PACKAGE VALID
Of course THIS IS NOT SUPPORTED like everything else I wrote
Thanks for the tip! Which database version did you try it on? I need to upgrade to 10.2, do you think it will work? If you also have any reference (eg. an Oracle document on the web) regarding this matter, it will be greatly appreciated.
Alex
agou@ait.gr
I think 11g.. or minimum would be 10.2.0.3
According to this document:
http://download.oracle.com/docs/cd/B14117_01/server.101/b10763/compat.htm#i1014341
the tip works on database version 10.1, but I am upgrading to 10.2. If anyone knows anything, please contact me at agou@ait.gr