• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

ORA-01002 fetch out of sequence

 
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can some one please explain me what is this error.I have read the explanation on oracle site.
But need some more explanation...

When i run the same query from the sql prompt it runs fine..but when i run it from the java program it gives me above error.
what does the below para means??

thanks,

trupti

Cause: In a host language program, a FETCH call was issued out of sequence. A successful parse-and-execute call must be issued before a fetch. This can occur if an attempt was made to FETCH from an active set after all records have been fetched. This may be caused by fetching from a SELECT FOR UPDATE cursor after a commit. A PL/SQL cursor loop implicitly does fetches and may also cause this error.

Action: Parse and execute a SQL statement before attempting to fetch the data.
 
trupti nigam
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
someone please answer to my question..
I am stuck cause of this



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

If you post the section of your code that's causing the error it's much easier for people to help you.

Also note that being impatient and posting twice is likely to make people ignore your post rather than rush to answer it. Which part of the paragraph don't you understand? Perhaps if you explain what you think the paragraph is saying then someone can help put you right. It's perfectly clear to me, but then English is my first language...

What it's basically saying is that you're trying to read from a cursor when there's nothing left to read. Without a code fragment I can't help you more than that.

Jules
 
trupti nigam
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Julian,

What is meant by "a FETCH call was issued out of sequence".
Also "successful parse-and-execute call must be issued before a fetch" means what.I want to know when Can i get this error.

The error is fixed now.I forgot to give connection.autoCommit(False),Hence I was gettig the error.But I didn't understand what was happening behind the scene in database /Sql??

Thanks,
Trupti
 
JulianInactive KennedyInactive
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, without the code, neither do I.
 
trupti nigam
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Julian here is the piece of code..

SalesReport.updateSalesRep(saletVO,con);(this is in the calling method)

The code is below..
ResultSet rs = null;
PreparedStatement pstmt = null;

try{
pstmt = con.prepareStatement(GET_UPDATE_SALES_RPT_QUERY,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1, offsetSalesReport.acn);
pstmt.setDate(2, offsetSalesReport.reportingPeriodEndDate);
I was getting the exception at the below line..
rs = pstmt.executeQuery();
if(rs.next()){
//populate old report
oldSalesReport = new SalesReportTransfer(

rs.getString(DBConstants.SALES_RPT_AGENCY_NBR),
rs.getDate(DBConstants.SALES_RPT_RPT_PERIOD_END_DATE),


rs.updateRow();

thanks,
Trupti
[ August 20, 2004: Message edited by: trupti nigam ]
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
trupti,
I'm only guessing, but the problem could be with the SQL in your "GET_UPDATE_SALES_RPT_QUERY". If you are using Oracle's JDBC driver, there are limitations on the queries you can use, in order to get a scrollable, updateable "ResultSet". See the Oracle "JDBC Developer's Reference Guide" for more details. For your information, the Oracle documentation is available from here:

http://tahiti.oracle.com

Good Luck,
Avi.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic