The HASH_CLEAR function removes all rows of data from a Hash Table. Hash Tables allow data to be stored in-memory for fast, efficient retrieval during processing. They are most commonly used for lookups to reference data vs selecting data from a relational table in a database.
Category
Specialized
Syntax
HASH_CLEAR(hash_table)
Parameters and Descriptions
| Parameter | Description |
|---|---|
| hash_table | The name of a previously declared hash_table. |
Usage
Use HASH_CLEAR when a hash table is being reused and all previously stored entries must be removed. Unlike HASH_REMOVE, which removes a single row identified by a key, HASH_CLEAR empties the entire hash table. After HASH_CLEAR is called, the hash table remains declared and can be populated again using HASH_STORE.
Example
Clear the TABLE_CHANGE_COUNTS hash table after sending the current unit-of-work summary so that the next unit-of-work starts with an empty hash table.
HASH_CLEAR(TABLE_CHANGE_COUNTS)