I am using Delphi 7 with ODAC 5.70.0.30 13.04.06 and .NET option
This is the code I am using:
q := 'insert into tblaudio (dtbegintime,dtendtime,szsector,szFacid,blobsound) ';
q := q + 'VALUES ';
q := q + '(:pdtbegintime,:pdtendtime,:pszsector,:pszFacid,:pblobsound)';
OraSoundQuery.SQL.clear;
OraSoundQuery.SQL.Text := q;
OraSoundQuery.ParamByName('pszFacid').Asstring := FacilityEdit.text;
OraSoundQuery.ParamByName('pszsector').Asstring := sectorcombo.text;
OraSoundQuery.ParamByName('pdtbegintime').Asdatetime := G_StartTime;
OraSoundQuery.ParamByName('pdtendtime').Asdatetime := G_EndTime;
OraSoundQuery.ParamByName('pblobsound').ParamType := ptInput; //to transfer lob data to oracle
OraSoundQuery.ParamByName('pblobsound').AsOraBlob.OCISvcCtx := OraSession1.OCISvcCtx;
OraSoundQuery.ParamByName('pblobsound').AsOraBlob.LoadFromFile(audiocapture1.audiofilename);
OraSoundQuery.ParamByName('pblobsound').AsOraBlob.WriteLob; I get the error "LOB IS NOT ALLOCATED"
OraSoundQuery.Execute;
I have NEVER used a BLOB field for anything. Can anyone point me in the right direction?
Thanks
BLOB Field HELP
-
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
Try to use the following code:
Code: Select all
q := 'insert into tblaudio (dtbegintime,dtendtime,szsector,szFacid,blobsound) ';
q := q + 'VALUES ';
q := q + '(:pdtbegintime,:pdtendtime,:pszsector,:pszFacid, empty_blob()) ';
q := q + ' returning blobsound into :pblobsound';
OraSoundQuery.SQL.Text := q;
OraSoundQuery.ParamByName('pszFacid').Asstring := FacilityEdit.text;
OraSoundQuery.ParamByName('pszsector').Asstring := sectorcombo.text;
OraSoundQuery.ParamByName('pdtbegintime').Asdatetime := G_StartTime;
OraSoundQuery.ParamByName('pdtendtime').Asdatetime := G_EndTime;
OraSoundQuery.ParamByName('pblobsound').ParamType := ptInput;
OraSoundQuery.ParamByName('pblobsound').AsBlobLocator.LoadFromFile(audiocapture1.audiofilename);
OraSoundQuery.Execute;