Insert using another TOracleDataSet's data?

phocai

Member²
I am using DOA 3.4.6.4 for Delphi 7 on Windows 2000 SP3 with Oracle 8i.

My TOracleDataSet has a select statement that creates a new record based on an existing record but containing new data. My Delphi app needs to access and use this record without changing it. Afterwards, I need to insert this new record into the Oracle table.

My question is: can I insert the contents of the TOracleDataSet directly into the Oracle table without re-executing the original select statement? My select statement contains a number of package calls and executing it twice seems inefficient. Same goes for inserting first and then re-querying the database to find the record I just inserted. I have the record, I just want to put it into the table.

Many thanks.
 
If you want to insert the selected data into a table, there are basically 2 options:

1. Create insert statements based on the selected data.

2. Use a second TOracleDataset for the destination table with an empty result set (e.g. select d.*, rowid from dest d where rownum = 0). Simply copy the records from the source dataset to the destination dataset.

------------------
Marco Kalter
Allround Automations
 
Would you be kind enough to elaborate on option #1? I have been unable to reference the selected data from another dataset.

Many thanks for your help.
 
I have figured this out (finally!). Using a second TOracleDataSet I create an insert statement on the fly using fields.fieldname and fields.value which uploads perfectly and works with any table structure.

Thank you again for pointing me in the right direction.
 
Back
Top