Question:
I am running a Pro*C program which was compiled with these Pro*C
precompiler flags:
mode = ORACLE DBMS = V7 UNSAFE_NULL = Yes
When I execute the program, it calls an Oracle stored procedure and
I get the fetching null value error.
The Oracle documentation suggests that the unsafe_null=yes
is all I need to avoid the ORA-24345 error and the NULL fetch error.
What else can cause the fetching null value error ORA-24345?
Answer: The
oerr utility shows these details for the ORA-24345 error:
ORA-24345: A Truncation or null fetch error occurred
Cause: A truncation or a null fetch error"
Action: Please
ensure that the buffer size is long enough to store the returned
data.
You need to start by
tracing the PL/SQL stored procedure and examine the program
trace or dump file and see exactly which row precipitated this
error!
It looks like you need to increase your Pro*C array buffer size to
be large enough to accept the incoming variable value from Oracle.
There are known issues causing the "null fetch error" when using
LONG datatypes, and you should change to a CLOB.
There are also known problems (bugs) with Pro*C and ?fetching null
values?, check MOSC for
issues and see MOSC Note 461048.1.
If you are passing a pointer to an array with Oracle values (a
char**), you may need to define your Pro*C array to be large enough
to accept the largest possible row from a LONG or CLOB datatype.