Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: sorting in oracle?

Re: sorting in oracle?

From: sybrandb <sybrandb_at_gmail.com>
Date: Wed, 11 Jul 2007 06:03:06 -0700
Message-ID: <1184158986.943903.148480@57g2000hsv.googlegroups.com>


On Jul 11, 2:59 pm, kilik3..._at_gmail.com wrote:
> If I create a table:
>
> CREATE TABLE FOO
> (
> BAR VARCHAR(5)
> );
>
> insert into foo values ('a');
> insert into foo values ('b');
> insert into foo values ('c');
> insert into foo values ('A');
> insert into foo values ('B');
> insert into foo values ('C');
>
> and run this select statement:
>
> select bar from foo order by bar;
>
> I get back:
>
> BAR
> -----
> A
> B
> C
> a
> b
> c
>
> Why don't I get back...
>
> BAR
> -----
> A
> a
> B
> b
> C
> c
>
> -Thx

Answers are usually version dependent. 5 digits and 3 dots. The answer to your question is Oracle by default has NLS_SORT=binary, which results in everything being ordered in the order of the ASCII characterset.l
Case insensitive sorting is available in 10g and higher.

--
Sybrand Bakker
Senior Oracle DBA
Received on Wed Jul 11 2007 - 08:03:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US