My Oracle Support Banner

Pro*C Array Fetch Can Return Too Many Rows (Doc ID 1335978.1)

Last updated on OCTOBER 06, 2022

Applies to:

Precompilers - Version 11.2.0.1 and later
Information in this document applies to any platform.

Symptoms

If a Pro*C program has an EXEC SQL SELECT INTO statement that fetches into an array, and is executed many times in a loop, using a different bind value for the WHERE clause, then the number of rows returned can exceed the array size by 1 in certain circumstances.

For example if the array has 50 rows and the query returns 60,55,7,60 rows in subsequent executions, then the number of rows returned is:

query result 60 --> fetches 50 (i.e. size of array).
query result 55 --> fetches 50
query result 7 --> fetches 7
query result 60 --> fetches 51

The problem seems to occur consistently on the execution that follows a query that fetches less than the maximum array size.

The following test program demonstrates this issue:

Cause

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
Symptoms
Cause
Solution
References


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