Solved

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

Posted on 2014-03-13
2
2,524 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
  • 2
2 Comments
 
LVL 73

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 73

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
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…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now