That is the most frightening story I've ever heard. Unbelievable and amazing.
The sheer "incorrectness" of your DBA is astounding.
You have ruined my day - seriously. Your DBA should not be allowed to advise anyone, especially on programming.
When 11g was under development, the PLSQL group asked me if there was anything I'd like to have added to PLSQL...
I requested that WHEN OTHERS be removed from the language. They would not comply :) however they did make it a WARNING - a warning that if you have a when others that does not raise the error - you almost certainly have a bug in the developed code.
ops$tkyte%ORA11GR1> show errors procedure maintain_t
Errors for PROCEDURE MAINTAIN_T:
LINE/COL ERROR
-------- -----------------------------------------------------------------
9/8 PLW-06009: procedure "MAINTAIN_T" OTHERS handler does not end in
RAISE or RAISE_APPLICATION_ERROR
that is how seriously messed up that concept is that your DBA proposes - it is such a bad idea the COMPILER YELLS at you "do not do it!!!!"
This is well known in all programming languages that throw exceptions. Developers have a very bad habit of catching any and all exceptions and hiding them. It is written about a lot:
http://gen5.info/q/2008/07/31/stop-catching-exceptions/ is a good example of what I'm talking about..
https://www.oracle.com/technetwork/issue-archive/2007/07-jul/o47asktom-092692.html Is one I wrote.
WHEN OTHERS - not followed by a raise or raise_application_error - is almost certainly a bug in the developed code. There is exactly one place it might be useful - and that would be the top level caller (as I mentioned), the top level invocation of the procedure block. For example, if you are coding in APEX, it might make sense to have the top level procedure have a when others - that logs the error and returns to the end user a nice looking error page (in this case, the top level client is PLSQL).
If it were a java application, then the plsql should contain NO when others not followed by a raise or raise_application_error, the top level in this case is the java application and it has a definite need to know there was an error that could not be handled.
Does your DBA know that by putting when others then <NO raise/raise application error> - the coder would break the Atomic part of the ACID principles - the stored procedure will allow some of it's work - what it did up to the exception - but not the bits that were skipped to remain in the database - not be transparently rolled back?
that is, the DBA is breaking the database, changing it's functionality - or at least proposing to do so. Their claim that an unhandled exception would cause core dumps on the server is ludicrous The reason for this new feature and what it looks like to the developer follows:
ops$tkyte%ORA11GR1> create table t( x varchar2(4000) );
Table created.
ops$tkyte%ORA11GR1> create or replace
2 procedure maintain_t
3 ( p_str in varchar2 )
4 as
5 begin
6 insert into t
7 ( x ) values
8 ( p_str );
9 exception
10 when others
11 then
12 -- call some log_error() routine
13 null;
14 end;
15 /
Procedure created.
There we have a procedure, it uses when others to capture the error into a logging table and continues on.
ops$tkyte%ORA11GR1> exec maintain_t( rpad( 'x', 4001, 'x' ) );
PL/SQL procedure successfully completed.
Someone invokes it, it sure appears to work right? Everything is good... or is it?
ops$tkyte%ORA11GR1> select * from t;
no rows selected
Hmm, that table is empty, that is not good - what happened?
ops$tkyte%ORA11GR1> alter procedure maintain_t compile
2 PLSQL_Warnings = 'enable:all'
3 reuse settings
4 /
SP2-0805: Procedure altered with compilation warnings
ops$tkyte%ORA11GR1> show errors procedure maintain_t
Errors for PROCEDURE MAINTAIN_T:
LINE/COL ERROR
-------- -----------------------------------------------------------------
9/8 PLW-06009: procedure "MAINTAIN_T" OTHERS handler does not end in
RAISE or RAISE_APPLICATION_ERROR
Ahh, it was the dreaded when others not followed by a raise or raise application error. And it is reported as a warning - just like java reports bad programming practices and C does and C++ and Ada and so on. The developer is free to ignore these warnings, at their own peril of course.
Here is an excerpt from Expert Oracle Database Architecture that shows what I mean when I say your DBA's proposal "breaks the database"
<quote>
Procedure-Level AtomicityIt is interesting to note that Oracle considers PL/SQL anonymous blocks to be statements as well. Consider the following stored procedure:
ops$tkyte@ORA10G> create table t ( x int check (x > 0));
Table created.
ops$tkyte@ORA10G> create or replace procedure p
2 as
3 begin
4 insert into t values ( 1 );
5 insert into t values (-1 );
6 end;
7 /
Procedure created.
ops$tkyte@ORA10G> select * from t;
no rows selected
ops$tkyte@ORA10G> select * from t2;
CNT
----------
0
So, we have a procedure we know will fail. The second INSERT will always fail in this case. Let¿s see what happens if we run that stored procedure:
ops$tkyte@ORA10G> begin
2 p;
3 end;
4 /
I fired and updated 1 rows
I fired and updated 1 rows
begin
*
ERROR at line 1:
ORA-02290: check constraint (OPS$TKYTE.SYS_C009598) violated
ORA-06512: at "OPS$TKYTE.P", line 5
ORA-06512: at line 2
ops$tkyte@ORA10G> select * from t;
no rows selected
ops$tkyte@ORA10G> select * from t2;
CNT
----------
0
As you can see, Oracle treated the stored procedure call as an atomic statement. The client submitted a block of code, BEGIN P; END;, and Oracle wrapped a SAVEPOINT around it. Since P failed, Oracle restored the database back to the point right before it was called. Now, if we submit a slightly different block, we will get entirely different results:
ops$tkyte@ORA10G> begin
2 p;
3 exception
4 when others then null;
5 end;
6 /
I fired and updated 1 rows
I fired and updated 1 rows
PL/SQL procedure successfully completed.
ops$tkyte@ORA10G> select * from t;
X
----------
1
ops$tkyte@ORA10G> select * from t2;
CNT
----------
1
Here, we ran a block of code that ignored any and all errors, and the difference in outcome here is huge. Whereas the first call to P effected no changes, here the first INSERT succeeds and the CNT column in T2 is incremented accordingly.
Note I consider virtually all code that contains a WHEN OTHERS exception handler that does not also include a RAISE to re-raise the exception to be a bug. It silently ignores the error and it changes the transaction semantics. Catching WHEN OTHERS and translating the exception into an old-fashioned return code changes the way the database is supposed to behave.
Oracle considered the ¿statement¿ to be the block that the client submitted. This statement succeeded by catching and ignoring the error itself, so the If error then rollback... didn¿t come into effect and Oracle did not roll back to the SAVEPOINT after execution. Hence, the partial work performed by P was preserved. The reason that this partial work was preserved in the first place is that we have statement-level atomicity within P: each statement in P is atomic. P becomes the client of Oracle when it submits its two INSERT statements. Each INSERT either entirely succeeds or fails. This is evidenced by the fact that we can see that the trigger on T fired twice and updated T2 twice, yet the count in T2 reflects only one UPDATE. The second INSERT executed in P had an implicit SAVEPOINT wrapped around it.
The difference between the two blocks of code is subtle, and something you must consider in your applications. Adding an exception handler to a block of PL/SQL code can radically change its behavior. A different way to code this¿one that restores the statement-level atomicity to the entire PL/SQL block¿is as follows:
ops$tkyte@ORA10G> begin
2 savepoint sp;
3 p;
4 exception
5 when others then
6 rollback to sp;
7 end;
8 /
I fired and updated 1 rows
I fired and updated 1 rows
PL/SQL procedure successfully completed.
ops$tkyte@ORA10G> select * from t;
no rows selected
ops$tkyte@ORA10G> select * from t2;
CNT
----------
0
Caution The preceding code represents an exceedingly bad practice. You should neither catch a WHEN OTHERS in general nor explicitly code what Oracle already provides as far as transaction semantics is concerned.
Here, by mimicking the work Oracle normally does for us with the SAVEPOINT, we are able to restore the original behavior while still catching and ¿ignoring¿ the error. I provide this example for illustration only¿this would be an exceeding bad coding practice.
</quote>
In short, loudly - explicitly and without backing down - refuse to do this, refuse.
It is a horrible coding practice
It does NOT do what your DBA claims (causes core dumps)
It WILL lead to countless hard to discover bugs
Just say NO