Re: global pragma exception init
From: Kurt Franke <Kurt-Franke_at_web.de>
Date: Fri, 09 May 2008 22:21:18 +0200
Message-Id: <978271111@web.de>
> SQL
>
> For example I have this in a package spec.
>
> insert_null_into_notnull EXCEPTION;
> PRAGMAEXCEPTION_INIT(insert_null_into_notnull,-1400);
> update_null_to_notnull EXCEPTION;
> PRAGMAEXCEPTION_INIT(update_null_to_notnull,-1407);
>
> i do not want do define them in every package/procedure/function, I
> want them defined at one place and want every package/procedure/
> function to use them. Is there any to achieve this? I am not a PL/SQL
> expert, so pardon my ignorance.
Date: Fri, 09 May 2008 22:21:18 +0200
Message-Id: <978271111@web.de>
Hi,
>Is there any way to create a global pragma excetpion init list in PL/
> SQL
>
> For example I have this in a package spec.
>
> insert_null_into_notnull EXCEPTION;
> PRAGMAEXCEPTION_INIT(insert_null_into_notnull,-1400);
> update_null_to_notnull EXCEPTION;
> PRAGMAEXCEPTION_INIT(update_null_to_notnull,-1407);
>
> i do not want do define them in every package/procedure/function, I
> want them defined at one place and want every package/procedure/
> function to use them. Is there any to achieve this? I am not a PL/SQL
> expert, so pardon my ignorance.
the closest methode to do this in an oracle supported way is to put those declarations in a separate package and use it with a full qualified name.
create package exc
as
insert_null_into_notnull EXCEPTION;
PRAGMA EXCEPTION_INIT(insert_null_into_notnull,-1400);
update_null_to_notnull EXCEPTION;
PRAGMA EXCEPTION_INIT(update_null_to_notnull,-1407);
end exc;
/
create procedure use_exc
as
begin
- application specific code ...
NULL;
exception
when exc.insert_null_into_notnull then
- application specific handling RAISE; end use_exc;
regards
kf
-- http://www.freelists.org/webpage/oracle-lReceived on Fri May 09 2008 - 15:21:18 CDT