[PLUG] HSQLDB string operations

John Jason Jordan johnxj at comcast.net
Sun Feb 24 01:27:57 UTC 2008


I need to sort a query baased on the rightmost three characters of a
field using HSQLDB, which is what OOo Base uses. The total number of
characters in this field varies from one record to the next, so I can't
just tell it to ignore the leftmost X number of characters. I went here:

http://hsqldb.org/web/hsqlDocsFrame.html

And found a list of built in operations, but I can't find a right-string
(length) type operator. I found a length operator, and a substring
operator that works from the left for len characters, but no right
(length) operator.

The problem is that the query I created in the GUI is sorting the data
on the entire contents of the field, where I need it sorted only on the
final three characters in the field, ignoring everything before the last
three characters. Base lets me edit the query in SQL, but I need to
figure out how to tell it to ignore all characters before the last
three. 

There has to be a way to do this. There just has to be. Are there any
HSQLDB experts in here?



More information about the PLUG mailing list