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: Order By problem with Dates

Re: Order By problem with Dates

From: <rock_cogar_at_my-deja.com>
Date: Wed, 18 Aug 1999 12:18:52 GMT
Message-ID: <7pe8b3$pod$1@nnrp1.deja.com>


I wish it was that easy. On Oracle 8.1.5 on NT 4.0 sp5, this is what I get from SQL Worksheet (1.3.5):

SQLWKS> select distinct to_char(to_date(substr(to_char(s_date),1,4)||'- '||substr(to_char(s_date),5,2)||'-'||substr(to_char(s_date),7,2),'YYYY- MM-DD'),'Mon DD, YYYY')

     2> from  tssds.ehefmsam
     3> where locdesc = 'MW-8'
     4> order by S_DATE asc;
order by S_DATE asc
         *

ORA-01791: not a SELECTed expression

Help !

Rock Cogar.

In article <934923181.4784.0.nnrp-03.9e984b29_at_news.demon.co.uk>,   "Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote:
>
> You are allowed to 'order by' something that does not
> appear in the select list, so you can do this:
>
> select distinct to_char(to_date(substr(to_char(s_date),1,4)||'-
'||substr
> (to_char(s_date),5,2)||'-'||substr(to_char(s_date),7,2),'YYYY-MM-
> DD'),'Mon DD, YYYY')
> from tssds.ehefmsam
> where locdesc = 'MW-8'
> order by s_date
> ;
>
> --
>
> Jonathan Lewis
> Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Wed Aug 18 1999 - 07:18:52 CDT

Original text of this message

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