• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

running the result from the end

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am runnung an example in which i want to fetch the results from the end means running the resultset from backward

I have wriiten this code



The problem is its compiling fine and when i am running it its showing an errorwhich state "Invalid column name"

I am using oracle 10g and table name is emp

Thanks in advance
 
deepak carter
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its resolved
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two notes on this:

1) You're trying to process the resultset "backwards", but your query does not contain the ORDER BY clause and therefore the database is free to send you the data in any order it feels like. Since the order of the records is undefined in your case, it does not make sense to process them backwards.

2) If you want to obtain the data from database in defined order, you need to use the ORDER BY clause. You can easily tell the database to revert the order using the DESC keyword (eg. ORDER BY ENAME DESC, EMPNO DESC) - the records will come out of the database sorted as you need them and you'll iterate them forwards, not backwards.

You should use normal, forward-only recordset whenever possible, as it is much more efficient and resource-friendly.
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

deepak carter wrote:its resolved



Because of this?

 
reply
    Bookmark Topic Watch Topic
  • New Topic