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: own order by

Re: own order by

From: Joachim Zobel <jzobel_at_my-dejanews.com>
Date: Tue, 09 Jul 2002 17:05:11 GMT
Message-ID: <3d2c8095.1884118@dilbert.crrrwg.de>


"Wolf" <a912165390_at_aon.at> wrote:

>Is there a way to tell oracle how the "order by" clause orders
>the database entries. (except asc, desc).
>Example:
>I want to sort VARCHAR2 Fields but no by alphabetical order.
>So I want to define that X is the first letter and F ist the second letter
>in order and so on...

Write something like:

  IF in_fld LIKE 'F%' THEN
    RETURN 20;
  END IF;   RETURN 100;
END; and doan
ORDER BY mysort(field)

You can do an ORDER BY containing a DECODE in your case, but this is IMHO cleaner and more flexible.

Hth,
Joachim

-- 
Diese Nachricht hat einen gueltigen From-Header. 
Emails an user_at_netcologne.de mit user = nc-zobeljo
werden sogar gelesen.
Received on Tue Jul 09 2002 - 12:05:11 CDT

Original text of this message

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