Given a prefix and an offset, constructs a unique error code for use within a package.
Note: This is not a PL/SQL exception.
FUNCTION Tool_Err.Encode
(prefix VARCHAR2,
offset PLS_INTEGER)
RETURN NUMBER;
Parameter | Description |
---|---|
prefix | A string of five characters. |
offset | An integer from 1 to 127. |
An error code.
/*
** Define a list of errors for a package
** called pkg_a.
*/
PACKAGE pkg_a IS
not_found CONSTANT pls_integer := TOOL_ERR.ENCODE('pkg_a', 1);
bad_value CONSTANT pls_integer := TOOL_ERR.ENCODE('pkg_a', 2);
too_big CONSTANT pls_integer := TOOL_ERR.ENCODE('pkg_a', 3);
too_small CONSTANT pls_integer := TOOL_ERR.ENCODE('pkg_a', 4);
. . . /* Rest of pkg_a specification */
END;