Which code will successfully create a BODILESS PACKAGE to standardize CONSTANTS and EXCEPTIONS declarations?
A package specification can be compiled without a body when it declares only items such as constants and exceptions. A constant declaration requires the CONSTANT keyword between the identifier and the datatype and must include an initialization, as in vtax CONSTANT NUMBER(3) := 3;. PRAGMA EXCEPTION_INIT associates a declared exception with an Oracle error number and takes the exception name as its first argument and the error code as its second, as in PRAGMA EXCEPTION_INIT(e_seq, -2277);. Omitting the constant's initial value, reversing the pragma's arguments, or placing CONSTANT after the datatype each raises a compilation error.
CONSTANT
vtax CONSTANT NUMBER(3) := 3;
PRAGMA EXCEPTION_INIT
PRAGMA EXCEPTION_INIT(e_seq, -2277);
Community Discussion