A script-enabled browser is required for this page to function properly.

TOOL_ERR.ENCODE built-in function

This function, given a prefix and an offset, constructs a unique error code for use within a package.

Note:This is not a PL/SQL exception.

Syntax


FUNCTION TOOL_ERR.ENCODE
(prefix VARCHAR2,
offset PLS_INTEGER)
RETURN NUMBER;

Parameters

Parameter

Description

prefix

A string of five characters.

offset

An integer from 1 to 127.

Returns

An error code.

Example


 /*
  ** 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; 

See also

About the TOOL_ERR built-in package

TOOL_ERR built-in package