Please enable JavaScript to view this site.

The HASH_LOAD function retrieves a row 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.

For more information about Hash Tables, please see the  Connect CDC SQData User Guide.

Category

Specialized

Syntax

HASH_LOAD(hash_table, hash_key)

 

Parameter Descriptions

hash_table  The name of a previously declared hash_table.

hash_key  This parameter specifies the value that will be compared against the key of the hash_table. The search value may be a field/column of a source datastore, a literal value (i.e. ABC), a variable or the result of another Function.

Example

Determine if a row exists in hash table H_EMPTBL1 using source field CDCIN.EMPNUM as the key. Code the statement something like this.

IF ISNULL(HASH_LOAD(H_EMPTBL1, CDCIN.EMPNUM)) = TRUE

  DO

     ...

  END

 

Search the H_EMPTBL1 hash table for a row with a key matching the value of EMPNUM. Retrieve data from a row in the H_EMPTBL1 hash table, you would code the statement something like this.

V_EMPDATA = HASH_LOAD(H_EMPTBL1, EMPNUM)

 

IF ISNULL(V_EMPDATA) = TRUE

   CALLPROC(no_entry_found_procedure)

ELSE

{

   target.SSN   = LEFT(V_EMPDATA, 9)   -- EXTRACT SSN

   target.LNAME = MID(V_EMPDATA,10,30) -- EXTRACT LAST NAME

   target.DEPT  = RIGHT(V_EMPDATA,10)  -- EXTRACT DEPT

}