Gem of the day

jdavidb on 2003-02-20T16:25:34

Today's Oracle gem is the DBMS_UTILITY.GET_HASH_VALUE function. This function takes three parameters: a VARCHAR2 string, a minimum value, and the size of the range of values, and returns a hash value. Oracle 9i, release 2 supports associative arrays in the form of PL/SQL tables indexed by VARCHAR2's, but earlier versions support indexing only by BINARY_INTEGER. However, using DBMS_UTILITY.GET_HASH_VALUE, you could build your own hash table object if you were desperate. In emergencies, it is said a skilled Jedi Master could find or manufacture his own gems and other required materials and build a lightsaber in two days, such as during the Clone Wars.

There's other uses for this, too. And, if you want a more cryptographically useful hashing algorithm, try MD5 in PL/SQL (by means of Bill Pribyl's open source PL/SQL repository).