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: How do I sort on final digit of a number?

Re: How do I sort on final digit of a number?

From: Marc <E.Mail_at_address.com>
Date: Thu, 20 Jan 2000 07:47:54 +0100
Message-ID: <866b8b$1dg$1@vkhdsu24.hda.hydro.com>


A shorter way to get the last character of a string is:

order by substr(to_char(test_id), -1)

Marc

Sybrand Bakker wrote in message
<948320214.17011.0.pluto.d4ee154e_at_news.demon.nl>...
>order by substr(to_char(test_id), length(to_char(test_id)))
>should do the trick.
>
>Hth,
>
>--
>Sybrand Bakker, Oracle DBA
>Wayne Menzie <waynem_at_bosmedtechdotcom.nospam> wrote in message
>news:8EC0A302Cwayneshammalammading_at_129.250.35.141...
>> I have a field that I need to sort on the final digit of a number like
>> this:
>>
>> Unsorted Sorted
>> Test_id Test_id
>> ------- -------
>> 101 101
>> 402 201
>> 1401 401
>> 201 1401
>> 202 202
>> 401 402
>>
>> Is there any way to do this with SQL or PL/SQL?
>>
>> Wayne Menzie
>
>
Received on Thu Jan 20 2000 - 00:47:54 CST

Original text of this message

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