Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> ORDER BY clause without sorting needed...
Hi all !
I got a following troubles: I wish that my query result set will be not sorted, but I with still have ORDER BY clause in it. Now I'm using 'ORDER BY -1' and following query example works fine:
SELECT id, name FROM customer ORDER BY -1
This query returns result set without sorting. (By the way:
SELECT id, name FROM customer ORDER BY 1
returns sorted by 'id' result set). But I got error 'ORA-01785: ORDER BY item must be the number of a SELECT-list expression' when I try 'ORDER BY -1' with UNION queries. Following statement causes error:
SELECT id, name FROM customer
UNION
SELECT 0, ' ' FROM dual
ORDER BY -1
Is there any another way to prevent query with ORDER BY clause from
sorting ? Why 'ORDER BY -1' works by different way with the UNION query ?
P.S. Duplicate answers (if any :( ) to my e-mail please...
--
Is There A God Or Any Kind Of Justice Under The Sky... (Queen'91)
Igor V. Podolsky (igoryok_at_soft-review.kiev.ua) Received on Tue Nov 10 1998 - 06:48:20 CST