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

Home -> Community -> Usenet -> c.d.o.misc -> Re: -- Sorting is nice ?!?

Re: -- Sorting is nice ?!?

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Fri, 09 Apr 2004 06:28:38 -0700
Message-ID: <1081517304.968461@yasure>


Andre wrote:
> Hello all,
>
> In a database I have a char field in which i store my chapter numbers (for a book)
>
> So the fiels are like this:
> 1.1
> 1.1.1
> 1.2
> 1.6
> 1.10
> 2.2
>
> etc...
> But When i sort these Chapters I get:
> 1.1
> 1.1.1
> 1.10
> 1.2
> 1.6
> 2.2
>
>
> So chatper 1.10 is before chapter 1.2?
>
>
> How can i solve this?
>
> regards and thanks,
>
> Anneke
> The Netherlands

The easiest way is to add an additional column to your table.

If you were writing an application I'd suggest writing a function that returns the correct numbering and then sort by FUNCTION(column).

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Fri Apr 09 2004 - 08:28:38 CDT

Original text of this message

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