GET_HASH_VALUE function - Compute a hash value for a given string
The GET_HASH_VALUE function provides the capability to compute a hash value for a given string.
The function returns a generated hash value of type INTEGER,
and the value is platform-dependent.
Syntax
Parameters
- name
- An input argument of type VARCHAR(32672) that specifies the string for which a hash value is to be computed.
- base
- An input argument of type INTEGER that specifies the starting value at which hash values are to be generated.
- hash_size
- An input argument of type INTEGER that specifies the number of hash values for the desired hash table.
Authorization
EXECUTE privilege on the DBMS_UTILITY module.
Examples
Example 1: The following
example returns hash values for two strings. The starting value for
the hash values is 100, with a maximum of 1024 distinct values.
SELECT DBMS_UTILITY.GET_HASH_VALUE('Peter',100,1024) AS HASH_VALUE
FROM SYSIBM.SYSDUMMY1@
SELECT DBMS_UTILITY.GET_HASH_VALUE('Mary',100,1024) AS HASH_VALUE
FROM SYSIBM.SYSDUMMY1@
This example results
in the following output:
SELECT DBMS_UTILITY.GET_HASH_VALUE('Peter',100,1024) AS HASH_VALUE
FROM SYSIBM.SYSDUMMY1
HASH_VALUE
--------------------
343
1 record(s) selected.
SELECT DBMS_UTILITY.GET_HASH_VALUE('Mary',100,1024) AS HASH_VALUE
FROM SYSIBM.SYSDUMMY1
HASH_VALUE
--------------------
760
1 record(s) selected.