Exceptions are part of PSQL code, but they are declared outside the package. Packages allow you to encapsulate code and exceptions without declaring exceptions in the schema. It will also be possible to use private exceptions.
Oracle declares exceptions exclusively in packages.
SET TERM ^;
CREATE PACKAGE P_TEST
AS
BEGIN
PROCEDURE P1(I INT);
END^
CREATE PACKAGE BODY P_TEST
AS
BEGIN
-- private exception
EXCEPTION E_NOT_ZERO 'Parameter not allow zero value';
PROCEDURE P1(I INT)
AS
BEGIN
IF (I = 0) THEN EXCEPTION E_NOT_ZERO;
END
END^
SET TERM ;^
CALL P_TEST.P1(0);
Exceptions are part of PSQL code, but they are declared outside the package. Packages allow you to encapsulate code and exceptions without declaring exceptions in the schema. It will also be possible to use private exceptions.
Oracle declares exceptions exclusively in packages.