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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Hash a URL

Re: Hash a URL

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 12 Aug 1999 15:32:09 +0100
Message-ID: <934468837.4001.2.nnrp-04.9e984b29@news.demon.co.uk>


With the correct version of Oracle, there is a published hash function in package dbms_utility:

 function dbms_utility.get_hash_value(

      name  varchar2,
      base  number,
      hash_size number

 ) return number;

The problem with hashing though is that two strings can hash to the same value, so you cannot really use a hash function for a unique key.

You could make the key

    (hash-value, meaningless sequence)
to emulate an overflow mechanism

--

Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk

risholmr_at_j51.com wrote in message <7oul7r$5ks$1_at_nnrp1.deja.com>...
>I have a table which I would like to have a URL as a primary key. A
>URL of course can be very long. Is it possible to do a HASH type
>function to reduce the size and use that as a surrogate key. Anyone
>know of a good HASHing algorithm which would do the trick?
>
Received on Thu Aug 12 1999 - 09:32:09 CDT

Original text of this message

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