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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: [Help] How to sort like this with SQL?

Re: [Help] How to sort like this with SQL?

From: Toni Gustafsson <tg_at_ENATOR.FI>
Date: Mon, 22 Jan 1996 08:19:49 +0200
Message-Id: <9601220633.AA31817@alice.jcc.com>


Hi,

I have used the following SQL to convert all numeric fields so that they are two characters logn, after wich I believe You would get the right results (assuming that each field has max 2 numbers).

select Work_Item
from Work_Table
order by
 substr (
 replace (
  replace (
   replace (
    replace (

     replace (
      replace (
       replace (
        replace (
         replace (
          replace (
           replace (
            '.' || replace (Work_Item,'.','..'),
            '.0.','.00.'),
           '.1.', '.01.'),
          '.2.', '.02.'),
         '.3.', '.03.'),
        '.4.', '.04.'),
       '.5.', '.05.'),
      '.6.', '.06.'),
     '.7.', '.07.'),

    '.8.', '.08.'),
   '.9.', '.09.'),
  '..', '.'),
  2,254);

I hope this helps

Greetings,

Toni Received on Mon Jan 22 1996 - 01:34:01 CST

Original text of this message

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