Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to recover a database from a user managed backup

743 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

9 Experts available now in Live!

Get 1:1 Help Now