Example of HASH with DB2® Multisystem

Use the HASH function to determine what the partitions should be if the partitioning key is composed of EMPNO and LASTNAME.

  • The query returns the partition number for every row in EMPLOYEE.
    SQL statement:
    SELECT HASH(EMPNO, LASTNAME)
       FROM CORPDATA.EMPLOYEE
    OPNQRYF command:
    OPNQRYF FILE((CORPDATA/EMPLOYEE))
            FORMAT(FNAME)
            MAPFLD((HASH '%HASH(1/EMPNO, 1/LASTNAME)'))