?
Solved

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

Posted on 2014-03-13
2
Medium Priority
?
2,644 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 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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
Suggested Courses

752 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