Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using Java class as a datatype

527285Aug 8 2006 — edited Aug 10 2006
I have a table that contains information about software. One of its columns is
VERSION varchar2(32) not null
The problem is that when I select from this table comparison must be something other the lexicographic. I.e. 1.11 < 11.1 or 2.0 > 2.0beta2.
So, I created the Java class Version that implements Comparable interface. Its method compareTo encapsulate all logic. I then loaded this class using loadjava utility and I am trying to test it.
I created
a) datatype using
create or replace type VERSION as object
external name 'com.mycompany.myproject.Version' language java using
SQLData (VALUE VARCHAR2(32));

b) table containing just two columns
create table TEST (TITLE varchar2(30) not null, VRSN VERSION);
I got no errors and can actually successfully insert data into the table.
However, if I am trying to retrieve data I am getting either empty value if no criteria specified, otherwise I am getting an error:
ORA-22950: cannot ORDER objects without MAP or ORDER method
I searched documentation and it mention these methods for UDTs but I did not find a single example.
Can someone point me to the right place or share a working example or, if you have an alternate idea how to achive the same result, I'd be glad to hear it too.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2006
Added on Aug 8 2006
3 comments
188 views