My Oracle Support Banner

Post Database Upgrade to 19c, Fetch from Cursor Based on Global Temporary Table Raises ORA-01002 (Doc ID 2890026.1)

Last updated on APRIL 17, 2023

Applies to:

PL/SQL - Version and later
Information in this document applies to any platform.


After the database is upgraded to 19c, fetch from a cursor created on Global Temporary Table(GTT) raises 'ORA-01002: fetch out of sequence' error when the activities are performed in the given order.

1. Records are inserted into a GTT.

2. A REF CURSOR variables is opened using the GTT.

3. The GTT is truncated or Commit/Rollback is issued.

4. The REF CURSOR variable is fetched.

The issue can be reproduced using the anonymous block given below.


The database server is upgraded to 19c. The issue is not observed in previous RDBMS versions.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.