I’m migrating our applications from Delphi 5 using ODAC (Ver. 5.50.0.16) to Delphi 2010 using ODAC (Ver. 7.20.0.6). In our applications we commonly use the TOraTable components. Inside each object’s properties we specify the properties KeyFields and KeySequence. In the Delphi 5 version (using ODAC 5.50) new records are inserted without a problem. The component automatically makes the query "SELECT SEQNAME.NEXTVAL FROM DUAL” and assigns the returned value to the table and field where we want to insert records, but this doesn’t work when using Delphi 2010 with ODAC 7.20, instead a value of 0 is stored in the table for the inserted record.
Is this a bug in the component TQraTable for the ODAC version 7.20.0.6 or is there another property or approach that I should consider ?
Notes:
1.- We only get errors when inserting records, retrieving data and updates work fine.
2.- We are aware the we could write a function to query the NextVal manually, but it would require a lot of effort to fix this in all the applications, so we would like to know if there’s a way to do it since the previous version worked without any issues.
Thanks for your help
Can't insert records using ODAC version 7.20 and Delphi 2010
-
franklinfreitas
- Posts: 2
- Joined: Tue 28 Jun 2011 20:47
Hello,
I cannot reproduce the problem.
If you've set the KeyFields and KeySequence properties correctly, OraTable will generate the Insert query correctly.
The Insert query in the latest ODAC versions looks like
Please turn on the debug mode:
and check that the query is generated and executed correctly using a third-party application, for example, SQL Plus.
I cannot reproduce the problem.
If you've set the KeyFields and KeySequence properties correctly, OraTable will generate the Insert query correctly.
The Insert query in the latest ODAC versions looks like
Code: Select all
INSERT INTO T_TABLE
(ID, TEXT)
VALUES
(sq_t_table.NEXTVAL, :TEXT)
RETURNING
ID
INTO
:IDCode: Select all
uses ..., odacvcl;
.....
OraTable.Debug := true;-
franklinfreitas
- Posts: 2
- Joined: Tue 28 Jun 2011 20:47
We already try checking the properties for the component and everything looks ok. In fact with our previous version project (Delphi 5) it works fine.
All we did was to open the Delphi 5 project using Delphi 2010. We were expecting it to work without any issues.
We will try installing the Delphi 2010 and the ODAC from scratch in another machine and see what happens.
I'll keep you posted
Thanks for your help
All we did was to open the Delphi 5 project using Delphi 2010. We were expecting it to work without any issues.
We will try installing the Delphi 2010 and the ODAC from scratch in another machine and see what happens.
I'll keep you posted
Thanks for your help