You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Lohonya László <lo...@dconstans.hu> on 2008/02/19 12:44:22 UTC

Order by clause with national character set

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?
 
Thanks in advance
LL

Re: Order by clause with national character set

Posted by Lolas <lo...@dconstans.hu>.
Hello Knut!
Thanks for your answer, it was very hepfully. I beg your pardon for this
late answer, I haven't known that I made this thread. I have registered just
now.
LL


Knut Anders Hatlen wrote:
> 
> Lohonya László <lo...@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
> 
> 

-- 
View this message in context: http://www.nabble.com/Order-by-clause-with-national-character-set-tp15565292p16122341.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Order by clause with national character set

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Lohonya László <lo...@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