Home » SQL & PL/SQL » SQL & PL/SQL » How to Select result 20-40 ordered?
How to Select result 20-40 ordered? [message #20271] Fri, 10 May 2002 00:37 Go to next message
Pierre Barnard
Messages: 1
Registered: May 2002
Junior Member
hi,

I want to select only a number of records at a time (say 20-40) of a resultset. But the resultset must be ordered for the whole table, not just for the 20-40 records. I have the following query, but keep getting error:

SELECT rownum,laborcode,name
FROM (
SELECT query.*, rownum row_id
FROM (
SELECT *
FROM labor ORDER BY laborcode ASC
) query
)
WHERE row_id > 20 AND rownum <= 40

The error is :

ORDER BY laborcode ASC
*
ERROR at line 5:
ORA-00907: missing right parenthesis

Is this because I am only on Oracle 806, or is there something wrong with the code?

Please help

Pierre
Re: How to Select result 20-40 ordered? [message #20277 is a reply to message #20271] Fri, 10 May 2002 07:13 Go to previous messageGo to next message
christina
Messages: 9
Registered: November 2001
Junior Member
send me the table structure of your tables.

-Christi
Re: How to Select result 20-40 ordered? [message #20290 is a reply to message #20271] Sat, 11 May 2002 07:37 Go to previous message
Su
Messages: 154
Registered: April 2002
Senior Member
Yes, it is Oracle version issue. Because Oracle 8.0.x is not Oracle8i, in which the virtual/instant tables are supported, it is giving you error. The query you have given includes a virtual or instant table creation, that is, the query you have given within () right after FROM, is only supported in Oracle8i or above, but not in Oracle 8.0.x versions. The Oracle8i starts from 8.1.x. Hope you understand my point.
Good luck :)
Previous Topic: Oracle 8i and 9i co-existence
Next Topic: Re: error to SET AUTO TRACE ON
Goto Forum:
  


Current Time: Mon May 20 16:20:16 CDT 2024