I'm trying to user à TOraLoader component to copy data from a table to another.
One of the fields is a "LONG RAW" field.
Is it possible to use a TOraLoader component to load data in a "LONG RAW" field ?
OraLoader with LONG RAW field
-
denis.willard
- Posts: 2
- Joined: Wed 06 Aug 2008 17:22
So I cannot use the TOraLoader component...
What is the best way to copy data from a table to another one, when there is a LONG RAW field ?
My table contains a lot of records (about 500 000) and the time spent in this operation is a critical issue for me... and I bought ODAC components specially for that...
What is the best way to copy data from a table to another one, when there is a LONG RAW field ?
My table contains a lot of records (about 500 000) and the time spent in this operation is a critical issue for me... and I bought ODAC components specially for that...
Hello,
To transfer a large volume of data you can use the following code:
OraQuery1.SQL.TEXT := 'SELECT FIELD1, FIELD2,...,FIELD_LONG_RAW1, ... FROM TABLE1';
OraQuery1.open;
OraQuery1.First;
OraQuery2.SQL.TEXT:= 'SELECT FIELD1, FIELD2,...,FIELD_LONG_RAW1, ... FROM TABLE2';
OraQuery2.SQLInsert.Text:= 'INSERT INTO TABLE2(FIELD1, FIELD2,...,FIELD_LONG_RAW1, ...) VALUES(:FIELD1, :FIELD2,...,:FIELD_LONG_RAW1, ...)';
OraQuery2.CachedUpdates:= True;
OraQuery1.Options.UpdateBatchSize:= 100;
OraQuery2.open;
While not OraQuery1.Eof do
begin
OraQuery2.Append;
OraQuery2.FieldByName('FIELD1').Assign(OraQuery1.FieldByName('FIELD1'));
OraQuery2.FieldByName('FIELD2').Assign(OraQuery1.FieldByName('FIELD2'));
...
OraQuery2.FieldByName('FIELD_LONG_RAW1').Assign(OraQuery1.FieldByName('FIELD_LONG_RAW1'));
...
OraQuery2.Post;
OraQuery1.Next;
end;
OraQuery2.ApplyUpdates;
In this case records will be inserted as a PL/SQL block on 100 rows at a time (rows count is set in the OraQuery1.Options.UpdateBatchSize parameter), LONG RAW data will be inserted correctly.
To transfer a large volume of data you can use the following code:
OraQuery1.SQL.TEXT := 'SELECT FIELD1, FIELD2,...,FIELD_LONG_RAW1, ... FROM TABLE1';
OraQuery1.open;
OraQuery1.First;
OraQuery2.SQL.TEXT:= 'SELECT FIELD1, FIELD2,...,FIELD_LONG_RAW1, ... FROM TABLE2';
OraQuery2.SQLInsert.Text:= 'INSERT INTO TABLE2(FIELD1, FIELD2,...,FIELD_LONG_RAW1, ...) VALUES(:FIELD1, :FIELD2,...,:FIELD_LONG_RAW1, ...)';
OraQuery2.CachedUpdates:= True;
OraQuery1.Options.UpdateBatchSize:= 100;
OraQuery2.open;
While not OraQuery1.Eof do
begin
OraQuery2.Append;
OraQuery2.FieldByName('FIELD1').Assign(OraQuery1.FieldByName('FIELD1'));
OraQuery2.FieldByName('FIELD2').Assign(OraQuery1.FieldByName('FIELD2'));
...
OraQuery2.FieldByName('FIELD_LONG_RAW1').Assign(OraQuery1.FieldByName('FIELD_LONG_RAW1'));
...
OraQuery2.Post;
OraQuery1.Next;
end;
OraQuery2.ApplyUpdates;
In this case records will be inserted as a PL/SQL block on 100 rows at a time (rows count is set in the OraQuery1.Options.UpdateBatchSize parameter), LONG RAW data will be inserted correctly.