db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Order by clause with national character set
Date Tue, 19 Feb 2008 12:16:34 GMT
Lohonya László <lohonya@dconstans.hu> writes:

> Hi,
>  
> I want to use a SQL statement with ORDER BY clause along with VARCHAR
> elements in which there are some national character (á,Á, ű,Ű, etc). Our
> (Hungarian)alphabet is: aA, áÁ, bB, cC, ... 
> How do I setup my Derby database to make these arrangements properly?

Hi,

It sounds like you need territory-based collation. Take a look at these
pages in Derby Developer's Guide:

http://db.apache.org/derby/docs/10.3/devguide/tdevdvlpcollation.html
http://db.apache.org/derby/docs/10.3/devguide/cdevcollation.html

Here's a small example:

ij version 10.4
ij> connect 'jdbc:derby:MagyarDB;create=true;territory=hu_HU;collation=TERRITORY_BASED';
ij> create table t (x varchar(10));
0 rows inserted/updated/deleted
ij> insert into t values 'aA', 'áÁ', 'bB', 'cC', 'aá', 'áa';
6 rows inserted/updated/deleted
ij> select * from t order by x;
X         
----------
aA        
aá        
áa        
áÁ        
bB        
cC        

6 rows selected


Hope this helps,
-- 
Knut Anders

Mime
View raw message