insert and read Raw
Posted: Mon 06 Oct 2008 08:39
Hi,
I am trying to insert a 32 bytes long string in a raw(32) field, because i don't want to oracle do any internal coding on the string. The string is actually composed by 8 integers, which make a 32 bytes string.
For my application, the speed is very important, so i would like commit thousands of records each time. I suppose inserting a string field is faster than that of 8 integers.
But it seems it can insert into the table but can not get the right value back from the raw field? My code looks like:
reading with the code:
And I got an empty string here. Can you help me with the problem? Thank you.
I am trying to insert a 32 bytes long string in a raw(32) field, because i don't want to oracle do any internal coding on the string. The string is actually composed by 8 integers, which make a 32 bytes string.
For my application, the speed is very important, so i would like commit thousands of records each time. I suppose inserting a string field is faster than that of 8 integers.
But it seems it can insert into the table but can not get the right value back from the raw field? My code looks like:
Code: Select all
with OraSQL1.SQL do begin
Clear;
Add('BEGIN');
Add('INSERT INTO '+ tablename + ' VALUES(');
Add(':RID, :SID, :A1);');
Add('END;');
end;
OraSQL1.Prepare;
counter := 0;
for I := 0 to Length(SLinks) - 1 do
begin
with OraSQL1.Params do begin
inc(counter);
Items[0].ItemAsInteger[counter] := SLinks[I].RId;
Items[1].ItemAsInteger[counter] := SLinks[I].SId;
Items[2].ItemAsString[counter] := SLinks[I].PackedStr;
end;
// data insert
if counter mod 5000 = 0 then
begin
OraSQL1.Execute(counter);
OraSession1.Commit;
counter := 0;
end;
end;
...
Code: Select all
str := OraQuery1.FieldByName('Abs').AsString;