Solved

Oracle Database Error: ORA-00903: invalid table name / Pagination with ROWNUM

Posted on 2014-03-13
2
2,613 Views
Last Modified: 2014-03-13
I am using Tom's example of pagination getting following error Oracle Database Error: ORA-00903: invalid table name

Can somebody please help?
 http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html

select *
  from ( select /*+ FIRST_ROWS(n) */
  a.*, ROWNUM rnum
      from (
SELECT p.fldstring folder_level_1,
       p2.fldstring folder_level_2,
       p3.fldstring folder_level3,
       d.doc_name
  FROM document d
       INNER JOIN folder f ON d.id = f.lid
       LEFT JOIN PATH p ON f.foldid = p.fldtype || '-' || p.fldkey
       LEFT JOIN PATH p2 ON p2.fldkey = p.fldkey2
       LEFT JOIN PATH p3 ON p3.fldkey = p2.fldkey2
,
      with order by ) a
      where ROWNUM <=
      :MAX_ROW_TO_FETCH )
where rnum  >= :MIN_ROW_TO_FETCH;
0
Comment
Question by:CalmSoul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 39927631
LEFT JOIN PATH p3 ON p3.fldkey = p2.fldkey2
,
      with order by ) a


you have a comma then "with order by"

what is "WITH" supposed to be?  and where is your order by clause?
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 39927635
I don't know what your ordering criteria is supposed to be, but as an example of what you might need...


SELECT *
  FROM (SELECT /*+ FIRST_ROWS(n) */
              a.*, ROWNUM rnum
          FROM (  SELECT p.fldstring folder_level_1,
                         p2.fldstring folder_level_2,
                         p3.fldstring folder_level3,
                         d.doc_name
                    FROM document d
                         INNER JOIN folder f ON d.id = f.lid
                         LEFT JOIN PATH p ON f.foldid = p.fldtype || '-' || p.fldkey
                         LEFT JOIN PATH p2 ON p2.fldkey = p.fldkey2
                         LEFT JOIN PATH p3 ON p3.fldkey = p2.fldkey2
                ORDER BY folder_level_1,
                         folder_level_2,
                         folder_level3,
                         d.doc_name) a
         WHERE ROWNUM <= :max_row_to_fetch)
 WHERE rnum >= :min_row_to_fetch;


note I removed the extraneous comma and the word "with"  and then specified the columns to order by
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question