To reproduce this error in sample code please make following steps:
1. change ODAC_CLOB table:
create table ODAC_CLOB
(
CODE NUMBER,
TITLE VARCHAR2(30) not null,
VALUE NCLOB
);
not null is needed to receive an exception on update (I my application it is completely different exception)
2. in ODAC clob example change properties for Query component as follows:
SQLUpdate.Strings = (
'UPDATE ODAC_CLOB'
'SET'
' CODE = :CODE, TITLE = :TITLE, VALUE=EMPTY_CLOB()'
'WHERE'
' ROWID = :Old_ROWID'
'RETURNING'
' VALUE'
'INTO'
' :VALUE')
Session = ODACForm.OraSession
SQL.Strings = (
'SELECT C.*, RowId FROM ODAC_CLOB C')
Debug = True
CachedUpdates = True
AutoCommit = False
Options.RequiredFields = False
3. Add few records to ODAC_CLOB table. Value field should not be empty.
4. add procedure to the example
Query.Edit;
Query.FieldByName('CODE').AsInteger := Query.RecNo;
Query.FieldByName('TITLE').Clear;
Query.GetLob('VALUE').AsWideString := 'TEST';
Query.Post;
Query.Session.StartTransaction;
try
Query.ApplyUpdates;
Query.Session.Commit;
Query.CommitUpdates;
except
Query.CancelUpdates;
Query.Session.Rollback;
raise;
end;
5. Call test procedure twice. At first time exception you should get ORA-01407 (cannot update TITLE to null) exception. This is correct. At second time Access Violation is raised.
Problem occur only if CancelUpdates is called after exception and value of NCLOB field is changed while editing.
I'm using Oracle 10gXE or Oracle 10g Standard, Delphi 6 Pro with all updates and ODAC 6.25.13.
I hope this description helps you remove this problem.