The HASHED_VALUE function returns the partition map index number of a row obtained by applying the hashing function on the partitioning key value of the row. Also see the HASH function. If the argument identifies a non-distributed table, the value 0 is returned. For more information about partition maps and partitioning keys, see the DB2(R) Multisystem book.
In SQL naming, the table name may be qualified. In system naming, the table name cannot be qualified.
If the argument identifies a view, common table expression, or derived table, the function returns the partition map index number of its base table. If the argument identifies a view, common table expression, or derived table derived from more than one base table, the function returns the partition map index number of the first table in the outer subselect of the view, common table expression, or derived table.
The argument must not identify a view, common table expression, or derived table whose outer subselect includes an aggregate function, a GROUP BY clause, a HAVING clause, a UNION clause, an INTERSECT clause, or DISTINCT clause. If the subselect contains a GROUP BY or HAVING clause, the HASHED_VALUE function can only be specified in the WHERE clause or as an operand of an aggregate function. If the argument is a correlation name, the correlation name must not identify a correlated reference.
The data type of the result is a large integer with a value between 0 and 1023. The result can be null.
Syntax alternatives: PARTITION is a synonym for HASHED_VALUE.
SELECT EMPNO FROM EMPLOYEE WHERE HASHED_VALUE(EMPLOYEE) = 100
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.