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: ROWID to NUMBER

Re: ROWID to NUMBER

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 23 Sep 1999 17:43:31 -0400
Message-ID: <+Z3qN6vuejIKuYDa1BJ2QV8BFVmp@4ax.com>


A copy of this was sent to Alessandro Santini <a.santini_at_cgi.it> (if that email address didn't require changing) On Thu, 23 Sep 1999 16:50:53 +0200, you wrote:

>Hi everybody,
>
>I have the need to convert a rowid to a number (to a Java int, more
>exactly), or if this is impossible, how to have an unique value for a
>row in a table without modifying the pre-existing structure. All of this
>to put rows into a hashtable.
>
>Thanks in advance.
>
>Alessandro Santini

rowids change from release 7 to 8 of oracle. In 7.x they looked like:

SVRMGR> select rowid from dual;
ROWID



00000130.0000.0001

In 8.0 and up they look like:

tkyte_at_8i> select rowid from dual
  2 /

ROWID



AAAADCAABAAAAHQAAA You might look into using dbms_utility.get_hash_value (good for a hash table maybe).

otherwise, apply some function to turn a string into a number (whats the official range of a java int? there may not be a good way to get a unique number out of it -- perhaps using dbms_utility.get_hash_value is the best bet -- its going into a hash table anyway -- hash the string instead of hashing the number)

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Sep 23 1999 - 16:43:31 CDT

Original text of this message

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