oracle - How to implement ora_hash (seedable hash that divides any sql datatype into n buckets) -
i've looked @ wikipedia article on hash tables doesn't seem how implement hash table can distribute entries of arbitrary sql datatype evenly n buckets.
can point me in direction of documentation or existing source code on topic?
i believe talking perfect hash function. oracle's ora_hash function not perfect hash function.
http://en.wikipedia.org/wiki/perfect_hash_function
as close seem want associative array. oracle has those. start playing example:
set serverout on size 10000 declare cursor foo select distinct fld1,fld2,fld9 sometable; type t table of foo.%rowtype index varchar2; -- alter index int if want myarray t; -- myarray table of records -- whatever foo returns begin x in foo loop -- index using first column of fetched row "fld1": myarray(x.fld1)=x; -- assign rowtype table of records. end loop; end; /
note: associative array built on hashtable, above illustration uses fld1 hash key. above work if describe, perfect hashing, if , if fld1 unique field. distinct in in there do. never required.
oracle hash ora-hash
No comments:
Post a Comment