Search Results get_next_hash_index
Overview
APPS.BEN_HASH_UTILITY is a Benefits module utility package that supplies a consistent hashing algorithm for caching data structures used throughout Oracle E-Business Suite Benefits processing. The package header comment states its purpose explicitly: to "provide consistent hashing algorithms for caching of data structures within benefits." In practice, the package converts a numeric identifier (typically a primary key from a Benefits entity) into a deterministic array or table index, and defines the traversal sequence used to step through that structure when collisions or overflow occur. Consolidating this logic in a single package guarantees that every Benefits component that caches data uses identical index arithmetic, which is essential for correctness when cached structures are shared across procedures or sessions.
The package body carries the RCS identifier benhashu.pkb 120.1 and a documented history beginning 01-MAY-99. Early versions removed hr_utility debug statements, version 115.3 added generic cache write routines (Write_MastDet_Cache and Write_BGP_Cache), version 115.4 modified write_mastdet_cache under Bug 3125540, and version 115.7 (12-JUN-05) removed both cache write routines and converted package locals into globals. In 12.1.1 and 12.2.2 the package therefore exposes only the hashing primitives; the cache write logic referenced throughout its history is no longer shipped.
Key Procedures and Functions
- GET_HASHED_INDEX — Returns the hashed index for a supplied numeric identifier, computed as the modulus of the identifier against the active hash key. This is the primary entry point used to map a Benefits record ID to a cache slot.
- GET_NEXT_HASH_INDEX — Given the current hash index, returns the next index in the probe sequence by adding the hash jump value. Callers iterate this function to resolve collisions.
- GET_HASH_JUMP — Returns the current jump (stride) value applied between successive hash indices.
- GET_HASH_KEY — Returns the current hash key, i.e. the modulus employed by GET_HASHED_INDEX.
- SET_HASH_JUMP — Sets the jump value used by GET_NEXT_HASH_INDEX, allowing a caller to tune the probe stride for its data volume.
- SET_HASH_KEY — Sets the hash key (modulus). The body commentary cautions that the setter should be used only where the entire data set is known to fall below 2**32, since a poorly chosen key increases index clashing.
No documented procedure accepts an invented parameter list; parameters are intentionally not restated here beyond the numeric inputs implied by the function names.
Tables Accessed
The ETRM metadata for 12.2.2 records no tables referenced through APPS synonyms. This is consistent with the design: BEN_HASH_UTILITY is a pure computational utility that performs modular arithmetic and returns scalars. Any persistence or caching of Benefits data structures occurs in the calling packages, which retain their own collections. The historical Write_MastDet_Cache and Write_BGP_Cache routines, removed in version 115.7, were the only members of this package that would have written cached data; their removal confirms the current package performs no DML.
Usage Notes
BEN_HASH_UTILITY is an internal, non-API-classified ("OTHER") package. ETRM reports it as referenced by 31 other packages, reflecting wide reuse across Benefits batch and online processing. Custom code should not call it in place of a supported API; it is best treated as infrastructure. Where custom PL/SQL must emulate Benefits caching behaviour, the canonical pattern is to call SET_HASH_KEY and SET_HASH_JUMP once to establish the working parameters, invoke GET_HASHED_INDEX for each identifier, and walk GET_NEXT_HASH_INDEX until a free slot is found. Because the parameters are stored as package globals, callers in the same session share them, and the values persist for the life of the session. No forms, concurrent programs, or public APIs are documented as direct entry points; invocation is entirely by other packaged code.