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: Jusung Yang <JusungYang_at_yahoo.com>
Date: 7 May 2003 14:28:26 -0700
Message-ID: <130ba93a.0305071328.31c0a95b@posting.google.com>


madhu17_at_vsnl.net (S Madhusudhanan) wrote in message news:<2eead8c7.0305070825.70f20add_at_posting.google.com>...
> Hi Gurus,
>
> I'm trying to develop a method to hash a set of columns and store the
> result in another column.
>
> Any query's on the set of columns would be hashed and the result would
> be looked up in the Hash Value column.
>
> Could somebody point me in the right direction on how to achieve this?
>
> Thanks and Regards
> S Madhusudhanan

You can get your own hash function or you can use the one from ORACLE. Like:

SQL> select dbms_utility.get_hash_value('abcd',100,800) from dual;

DBMS_UTILITY.GET_HASH_VALUE('ABCD',100,800)


                                        871

SQL> select 1 from dual where
871=dbms_utility.get_hash_value('abcd',100,800);

         1


         1

SQL> SQL> select * from test2;

C1 C2
-- ----------

b           2
c           3
e           1
K           6
P           0
G           0
ap          9
G           1
G           1

9 rows selected.

SQL> select dbms_utility.get_hash_value(c1||to_char(c2),100,800) hashed_col from test2;

HASHED_COL


       812
       373
       283
       161
       804
       568
       718
       390
       390

9 rows selected.

SQL>

Received on Wed May 07 2003 - 16:28:26 CDT

Original text of this message

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