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

Home -> Community -> Mailing Lists -> Oracle-L -> Comparing two rowids

Comparing two rowids

From: Arul Ramachandran <contactarul_at_gmail.com>
Date: Tue, 28 Nov 2006 11:33:14 -0800
Message-ID: <1c1a62990611281133x5d0423g6325586a005d5e61@mail.gmail.com>


Is comparing two rowids (example: rowid1 >= rowid2) a legal operation?

We developed a pl/sql code that does this comparison and noticed the compare behaves one way in the pl/sql code and a different way in sqlplus. It is possible the SQL engine and PL/SQL engine treat them differently (bug?)

Oracle 10.2.0.1:

PL/SQL code:

declare

   rowid1 rowid := 'AAAKPkAAKAAARs7AAC';    rowid2 rowid := 'AAAKPkAAKAAARs+AAA'; begin

   dbms_output.put_line(case when rowid1 >= rowid2 then 'Yes' else 'No' end);
end;
/

The above code outputs 'Yes'

SQL code:

create table dummy ( rid1 rowid, rid2 rowid ); insert into dummy values ( 'AAAKPkAAKAAARs7AAC', 'AAAKPkAAKAAARs+AAA' ); commit;

select case when rid1 >= rid2 then 'Yes' else 'No' end from dummy;

SQL> select case when rid1 >= rid2 then 'Yes' else 'No' end from dummy;

CAS

---
No

The above code outputs 'No'
To me comparing  two rowids does not make sense, I can't see how one rowid
be greater than another? But then I see a ML note 2714430.8: "Bug 2714430 -
Wrong results from ROWID comparison to rowid with slot#>32767" that talks
about rowid comparison.

Any insights on this?

Thanks,

-- 
Arul

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Nov 28 2006 - 13:33:14 CST

Original text of this message

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