No, it still acts as a sub-query.
??
Main Topics
Browse All Topics CURSOR amd
IS
SELECT SID, NAME, phoneno, CLASS
FROM (SELECT ROWNUM c, SID, NAME, CLASS, phoneno
FROM student
WHERE CLASS = :classes AND branch = :student.br
AND edate IS NULL)
WHERE c <= 20
ORDER BY SID;
is working fine in forms 6i.
but i want ORDER BY IN subquery
CURSOR amd
IS
SELECT SID, NAME, phoneno, CLASS
FROM (SELECT ROWNUM c, SID, NAME, CLASS, phoneno
FROM student
WHERE CLASS = :classes AND branch = :student.br
AND edate IS NULL order by SID)
WHERE c <= 20;
In SQL*Plus both working fine but in forms the 2nd creates problems
I know it is odd to use order by in subquery but i need it here because of rownum
any solutions
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
http:#24763954 answers the question. bulk of it explains what is wrong, last two lines provide alternatives for forms limitations
Business Accounts
Answer for Membership
by: sdstuberPosted on 2009-07-02 at 07:49:01ID: 24763954
oracle forms 6i and lower has its own sql and pl/sql parser which doesn't support everything the server does
in any case you will probably want another level of nesting your subqueries
because ROWNUM is applied before order by.
If you want your data ordered then numbered try this...
CURSOR amd
IS
SELECT SID, NAME, phoneno, CLASS
FROM (SELECT ROWNUM c, sid,name,class,phoneno from
(select SID, NAME, CLASS, phoneno
FROM student
WHERE CLASS = :classes AND branch = :student.br
AND edate IS NULL order by SID))
WHERE c <= 20;
In order to get your cursor to work in forms you will either have to put it in a server side pl/sql block and return it as reference cursor or you will need to use dynamic sql so the server will parse it instead of the form.
Or, wrap query in a view on the server side and query it. Note, that will likely preclude your parameters. Unless you write it with analytics