Solved

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

Posted on 2014-03-13
2
2,587 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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 syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Via a live example, show how to take different types of Oracle backups using RMAN.

738 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