Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Comparing two rowids
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-lReceived on Tue Nov 28 2006 - 13:33:14 CST
![]() |
![]() |