Access Violation on nclob update in cached updates mode

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Traptak
Posts: 26
Joined: Fri 29 Jun 2007 07:15

Access Violation on nclob update in cached updates mode

Post by Traptak » Mon 21 Jan 2008 15:34

I have problem while updating records with nclob field.
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. :)

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Tue 22 Jan 2008 15:01

We reproduced and fixed this problem. This fix will be included in the next build of ODAC.

Post Reply