Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to hash a set of columns ?

Re: How to hash a set of columns ?

From: S Madhusudhanan <madhu17_at_vsnl.net>
Date: 8 May 2003 09:40:10 -0700
Message-ID: <2eead8c7.0305080840.6d92e306@posting.google.com>

"Anurag Varma" <avdbi_at_hotmail.com> wrote in message news:<YWkua.5456$2c4.2458_at_news02.roc.ny.frontiernet.net>...

> "Jusung Yang" <JusungYang_at_yahoo.com> wrote in message news:130ba93a.0305071328.31c0a95b_at_posting.google.com...
> > madhu17_at_vsnl.net (S Madhusudhanan) wrote in message news:<2eead8c7.0305070825.70f20add_at_posting.google.com>...
<snip>
> To OP:
> Be aware however that dbms_utility.get_hash_value might return same/duplicate
hash value for two different strings.
> In Jusung's case for example:
> SQL>select dbms_utility.get_hash_value('KU$_CONSTRAINT_COL_LIST_T',100,800) hashval
> 2 from dual;
>
> HASHVAL
> ----------
> 899
>
> SQL>select dbms_utility.get_hash_value('GV$TRANSACTION_ENQUEUE',100,800) hashval
> 2 from dual;
>
> HASHVAL
> ----------
> 899
>
> ... try this query yourself ..
> 1 select oname, dbms_utility.get_hash_value(oname,100,800) hashval
> 2 from (select distinct object_name oname from dba_objects)
> 3* order by hashval
>
> ... of course if you change the ranges, the above might not clash
> SQL>select dbms_utility.get_hash_value('GV$TRANSACTION_ENQUEUE',100,8000) hashval from dual;
>
> HASHVAL
> ----------
> 5699
>
> SQL>select dbms_utility.get_hash_value('KU$_CONSTRAINT_COL_LIST_T',100,8000) hashval from dual;
>
> HASHVAL
> ----------
> 4099
> .. however, original point being: The values are not guaranteed to be unique. Just be aware of it and take appropriate precautions.
>
> Anurag

Jusung & Anurag,

Thank you very much for the replies.

Regards
S Madhusudhanan Received on Thu May 08 2003 - 11:40:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US