Subject Baffling stored procedure error message. Any debugging tips?
Author mlq97
I'm using Delphi 2006, TIBO data access components, Firebird 2.0.

I have a button on a Delphi form which executes a stored procedure
called "Add_A_Freight_Charge" which receives an integer parameter
"V_DOC_ID". (I have determined that in all cases the parameter is
correctly passed to the SP).

The first time I execute the SP by pressing the button, I get an error

Debugger Exception Notification
Project Inigo.exe raised exception class EIBO_ISCError with message
'ISC ERROR CODE:335544347

validation error for column PROJ_ID, value "*** null ***"

Break Continue Help

The second and subsequent times that I execute the SP by pressing the
button, it works OK.

When I manually provide the parameter value and execute the procedure
in IbExpert it works every time. This is even the case when running it
while my app form is open in the same state as when an error occurs.

I can't understand why the same SP should behave differently like
this. Does the error message imply that the error is within the SP or
caused by some external condition? Does anyone have any clues as to
what might be going on?

Many thanks,