Skip to content

Instantly share code, notes, and snippets.

@ThiefMaster
Created January 13, 2014 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThiefMaster/f0b818f4d4514332e557 to your computer and use it in GitHub Desktop.
Save ThiefMaster/f0b818f4d4514332e557 to your computer and use it in GitHub Desktop.
function get_hash_value(name varchar2, base number, hash_size number)
return number;
PRAGMA RESTRICT_REFERENCES(get_hash_value, WNDS, RNDS, WNPS, RNPS);
-- Compute a hash value for the given string
-- Input arguments:
-- name - The string to be hashed.
-- base - A base value for the returned hash value to start at.
-- hash_size - The desired size of the hash table.
-- Returns:
-- A hash value based on the input string.
-- For example, to get a hash value on a string where the hash value
-- should be between 1000 and 3047, use 1000 as the base value and
-- 2048 as the hash_size value. Using a power of 2 for the hash_size
-- parameter works best.
-- Exceptions:
-- ORA-29261 will be raised if hash_size is 0 or if hash_size or
-- base are null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment