Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Complex ORDER BY clauses
Jonathan,
Your solution is identical to the one I posted earlier -- thanks for the additional comments.
Daniel,
In your earlier post your ORDER BY only included the DECODE expression, it did not include the secondary sort expression, which is why it would fail depending on the physical or retrieval order of the rows that got classed as sort type '99'.
As we used to say "4 eyes are better than 2" -- but if we take into contacts into consideration I guess it's 8 eyes are better than 4.
"Daniel Morgan" <damorgan_at_x.washington.edu> wrote in message
news:1068967371.133801_at_yasure...
| Jonathan Gennick wrote:
|
| > On Sun, 16 Nov 2003 00:08:21 -0500, Jonathan Gennick
| > <jonathan_at_gennick.com> wrote:
| >
| >
| >>An interesting twist on this problem would be to sort B and E first,
| >>and then everything else in alphabetical order.
| >
| >
| > Ah, I just had a thought. Try this:
| >
| >
| > SELECT test_col
| > FROM t
| > ORDER BY DECODE(test_col,'B',1,'E',2,99), test_col;
| >
|
| This is very strange. I built a demo in which the above code, which
| if you look is the first code I put here in response to the OP didn't
| work. I even used the demo with my students. Now I can't duplicate
| the conditions: Strange. So since I can't duplicate the failure I
| will concede for the moment that the in-line view may not be necessary.
|
| But I'd sure like to have that demo I did where it failed. Oh well!
|
| --
| Daniel Morgan
| http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
| http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
| damorgan_at_x.washington.edu
| (replace 'x' with a 'u' to reply)
|
Received on Sun Nov 16 2003 - 10:47:33 CST