ORA-1002 When Fetching A Ref Cursor (Doc ID 413199.1)

Last updated on JULY 05, 2017

Applies to:

Precompilers - Version 9.2.0.8 and later
Information in this document applies to any platform.
***Checked for relevance on 14th Jul 2016***

Symptoms

In Pro*C program, calling a Stored Procedure/Function with an OUT ref cursor parameter using the "EXEC SQL CALL func(:refcur);" format returns an invalid ref cursor variable, resulting in a subsequent FETCH failing with ORA-01002 "fetch out of sequence".

If the anonymous block format is used instead, this works ok:

EXEC SQL EXECUTE
  BEGIN
    func(:refcur);
  END;
END-EXEC;

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms