Setting CLOB field to NULL on DB2 / UDB gives error

Hi there,

We have a serious problem with updating CLOB fields in a DB/2 UDB database.
The problem happens when entering a NULL value in a CLOB field and saving it
to the database.
Any suggestions, fixes, similar experiences, etc are VERY welcome!!!

Thanks,
 Michel
 Mic...@Relational-Consultancy.com

------------- Start of problem description

Delphi setup:
------------
A query that selects a CLOB (or BLOB) field, connected to a ClientDataSet
via a Provider (all on the same module).
The query: SELECT ID, DESC FROM TESTBLOB (ID is an integer, DESC is a CLOB).

Problem description:
-------------------
Situation 1: Using the TQuery to update.
(or ClientDataSet with Provider.ResolveToDataSet = True).

When the update is performed (CLOB to null), the NULL value is converted to
an empty (non-null) value. Apart from this inconsistency, there are no
errors.
The query behaves the same for non-cached and cached, with and without a
TUpdateSQL component.

Situation 2: Using TClientDataSet to update (Provider.ResolveToDataSet =
False).

When the update is performed (CLOB to null), we get the error "Function
sequence error". Before this error, the SQLMonitor shows the error:

SQL Execute: DB2 - update "TESTBLOB" set "DESC" = ? where "ID" = ?
SQL Error: DB2 - [IBM][CLI Driver] CLI0158E  Error writing to a file.
SQLSTATE=S1508
SQL Error: DB2 - Unmapped SQL Error Code: -99999

The Function sequence error happens after aborting the transaction and
re-executing the query.

Configurations:
--------------
- Client uses NT WorkStation 4.0 (Service Patch 3).
- Database: DB2/UDB (on RS/6000) & Client enabler 5.2.
- Delphi 4 service pack 3.
- BDE 5.0.1 and BDE 5.1.0, using the native DB2 driver.
- DB2 DLL32 setting (BDE Admin) SQLDB232.DLL and SQLDB2V5.DLL.
  Note: There is no reference in the documentation about SQLDB2V5.
  Using it results in a different error message: "General SQL Error".
  The initial error is the same.

Testing with the ODBC driver was not possible. When selecting any CLOB
field, the field it is not in the result set (other fields are returned).
This is a (seperate) problem.

------------- End of problem description