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: SQL Order

Re: SQL Order

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Tue, 17 Sep 2002 16:17:18 +0100
Message-ID: <3d874780$0$1293$ed9e5944@reading.news.pipex.net>


There was a thread a short time ago about specifying a custom sort order in which I suggested an equivalent for the traditional workaround to the 'case insensitivity' problem namely add a column to your table and populate it via a trigger based on the sort order you want). Pabla (I think) suggested the perhaps more elegant solution of storing the sort order in a table and joining to thjis table to do the order by.

--
Niall Litchfield
Oracle DBA
Audit Commission UK
*****************************************
Please include version and platform
and SQL where applicable
It makes life easier and increases the
likelihood of a good answer

******************************************
"Lucas" <Lucas_44_at_hotmail.com> wrote in message
news:6vHh9.1277$EA.131191_at_news0.telusplanet.net...

> After extensive testing/usage of 'decode', it only seems to handle ~150
> codes than I get an 'ORA-00939 too many arguments for function'....any
other
> way of solving my original problem?
>
> Greatly appreciated,
>
> Lucas
>
>
> "Lucas" <Lucas_44_at_hotmail.com> wrote in message
> news:v%ph9.5$EA.6227_at_news0.telusplanet.net...
> > Tanks, this works for me.....
> >
> >
> > "Sybrand Bakker" <gooiditweg_at_sybrandb.demon.nl> wrote in message
> > news:248cou08niv2ev5g2i3l8bl6uga0q4jaa8_at_4ax.com...
> > > On Mon, 16 Sep 2002 17:23:16 GMT, "Lucas" <Lucas_44_at_hotmail.com>
> > > wrote:
> > >
> > > >Hi all,
> > > >
> > > >I want my query result to be in the same order as my codes that I
set:
> > > >
> > > >Ex:
> > > >
> > > >select * from
> > > >Emp
> > > >where empcode in (810,974,603,648)
> > > >
> > > >The result is not at all in this order? Any suggestions on why? Or is
> > there
> > > >a better way of doing this?
> > > >
> > > >
> > > >Lucas
> > > >
> > > >
> > > We're talking about relational databases and about sets here. Sets are
> > > by definition unordered.
> > > The solution would be to
> > > select decode(empcode,810,1,974,2,603,2,648,3,null) sortorder, *
> > > from emp
> > > where empcode in (810,974,603,648)
> > > order by sortorder
> > >
> > >
> > > Hth
> > >
> > >
> > > Sybrand Bakker, Senior Oracle DBA
> > >
> > > To reply remove -verwijderdit from my e-mail address
> >
> >
>
>
Received on Tue Sep 17 2002 - 10:17:18 CDT

Original text of this message

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