Is there by any possibility a compiler directive for Oracle PL/SQL to identify another source member whose contents would be fetched and replace the directive when the package or procedure is compiled? This would be similar to '#include' in C or what we used to refer to as macros in s/370 assembly language. Out of necessity the source being included would only be stored as text and not compiled itself. I'm thinking the answer must be no since this would seemingly require a source type other than PACKAGE, PACKAGE BODY, or PROCEDURE, but I'd rather know for sure rather than assume.
For example, given a source member named INCLUDED_CODE in the APPS schema that contains the following:
XX_MESSAGE varchar(100)
XX_EXCEPTION exception;
procedure XX_ABORT (XX_MSG_CODE in number,XX_MSG_TEXT in varchar)
as
begin
XX_MESSAGE := substr('XX-'||to_char(abs(XX_MSG_CODE)||': '||XX_MSG_TEXT||chr(32)||chr(13)||chr(10)||SQLERRM,1,100);
raise XX_EXCEPTION;
end;
/
And a package body:
create or replace package body APPS.XX_TEST_PKG
as
procedure XX_TEST_PROC (ERRBUFF out nocopy varchar2,RETCODE out nocopy varchar2,P_INPUT in varchar2)
is
$INCLUDE APPS.XX_ABORT
--
-- MAINLINE
--
begin
.
.
.
XX_ABORT(-20001,'<some message text>'');
.
.
.
exception
when XX_EXCEPTION
then
ERRBUFF := XX_MESSAGE;
RETCODE := 2;
end XX_TEST_PROC;
end XX_TEST_PKG;
/
The compiler would see the following upon execution of the member including the package body:
procedure XX_TEST_PROC (ERRBUFF out nocopy varchar2,RETCODE out nocopy varchar2,P_INPUT in varchar2)
is
XX_MESSAGE varchar(100)
XX_EXCEPTION exception;
procedure XX_ABORT (XX_MSG_CODE in number,XX_MSG_TEXT in varchar)
as
begin
XX_MESSAGE := substr('XX-'||to_char(abs(XX_MSG_CODE)||': '||XX_MSG_TEXT||chr(32)||chr(13)||chr(10)||SQLERRM,1,100);
raise XX_EXCEPTION;
end;
--
-- MAINLINE
--
begin
.
.
.
XX_ABORT(-20001,'<some message text>'');
.
.
.
exception
when XX_EXCEPTION
then
ERRBUFF := XX_MESSAGE;
RETCODE := 2;
end XX_TEST_PROC;
end XX_TEST_PKG;