[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Fetch out of sequence error.



Hello all,

I have a problem where an extremely simple select causes a "fetch out of
sequence" error.  I think that it is caused by the cursor unexpectedly
closing in the middle of the select.  This always occurs after a specific
record is read ( sys_fkey = 16852 ) regaurdless of what "order by" is used.
Even though I have trapped the error with on error the select stops after
this record. ( fyi_char30 is NULL for that record).  The select works
fine in sqlplus.

Does anyone have any thoughts?

Thanks,
Eric

here is the code:
begin-program
  do main
end-program

begin-procedure main
  show 'start'

begin-select on-error=error
fyi_char30 &char30
sys_fkey
  show &sys_fkey '  -  ' &char30
from
  fyi_asset_fold@bfnfyi.world
where
  sys_fkey > 16850 and
  sys_fkey < 16860
end-select

  show 'done'
end-procedure

begin-procedure error
  show 'begin-error'
  show #sql-status
  show $sql-error
  show 'Char30 = ' &char30
  show 'Fkey   = ' &sys_fkey
  show 'end-error'
end-procedure

and here are the results:
SQR: Structured Query Report Writer V3.0.12.1
Copyright (C) MITI, 1994, 1995.  All Worldwide Rights Reserved.

start
16851  -  BFN-3-XIS -099-0002
16852  -
begin-error
-1002.000000
ORA-01002: fetch out of sequence
Char30 =
Fkey   = 16852
end-error
done

SQR: End of Run.

 $ sqr -id

          SQR/3.0.12.1/Sun/Solaris 2.4/Oracle 7.0.16/Dec 01 1995