Page 1 of 1

Strange OraTable problem during append / rowid

Posted: Thu 14 Sep 2006 09:17
by Moehre
I have a very strange problem with TOraTable (Odac 5.7 for delphi):

I use a TOraTable component with FilterSQL property set to something like "MANDANT = :m1 AND LAGER = :m2". I then open it and check, wether dada exists or not. If not, I try to append:

TOraQuery.Append;
TOraQuery.Fields[0].AsString := '1';
TOraQuery.Fields[1].AsString := '99';
...

In my old version compiled with an older Odac suite this worked fine. Now, at the first "Fields[0].AsString :=" line I get an error:

"Field ROWID can not be changed"

In fact, Fields[0] refers to ROWID, this did not happen in the older version! If I run the program against an 8.1i Oracle DB this error occurs; if I start it on my local 10g test database, it works fine?!

Why does TOraTable behave this way? How can I deactivate the select of the ROWID as FIELD[0] ?

Many thanks in advance
Detlev Moehring, germany

Edit: I have made some tests and it grows stranger and stranger:

I created a table TEST with a few columns and build a test application to use TOraTable for selecting and editing data. That works fine! If i debug TOraTable.sql.text it is "SELECT * FROM TEST" and that's what I want.

So I replaced the Tablename "TEST" with the original tablename (on the same database) and after the prepare statement I checked the "TOraTable.SQL.TExt" property again;

"SELECT ROWID, T FROM "

WHY?? What is the reason for TOraTable to use another query strategy on different tables?

That is ugly!

Odac 3.5 works!

Posted: Thu 14 Sep 2006 10:31
by Moehre
I found an older version of my program using Odac 3.5; this works fine! So this must be a "feature" of ODAC5 ...

Posted: Fri 15 Sep 2006 06:43
by Plash
ODAC uses ROWID when KeyFields property of TOraTable is empty. Check that your table has a primary key and set TOraTable.KeyFields property accordingly.

Posted: Fri 15 Sep 2006 09:50
by jfudickar
OR use the fieldnames and not the positions to assign values.

Greetings
Jens

Posted: Thu 21 Sep 2006 04:21
by Moehre
@all: Thx for your response!

Sorry for my late response, but I had to react immediately and solved the problem with a workaround (if the first field is named "ROWID" I increase the field counter). I have to use field-id's because of a main procedure for opening / appending data on a data mining system with MANY tables.

I will try the setting of the keyfields property if I got some time for it ... ;)

Thx again
Detlev Moehring