Hi I would like to know which one is the best way when need to record the contents from some memo component to a clob field on table, using tOraStoredProc. I´m declaring the clob field as ftString like this:
vStored.Params.CreateParam(ftString,'P_SINOPSE',ptInput);
and passing value to it like this:
vStored.Params.ParamByName('P_SINOPSE').AsString:=MemSinopse.text;
is this the best way to work? My procedure header is like this:
...P_SINOPSE IN CLOB...
Please, let me know if I´m doing something wrong. ftString is the best declaration type to receive some Tmemo data?
thanks
Passing Memo Text to Clob Field by TOraStoredProc
-
brunomaximomogi
- Posts: 2
- Joined: Thu 18 Oct 2007 05:43
You should use a parameter of ftOraClob type. Use the following code to pass a value to the parameter:
You also need to set the TemporaryLobUpdate option of TOraStoredProc to True.
Code: Select all
vStored.ParamByName('P_SINOPSE').AsOraClob.AsString := MemSinopse.Text;-
brunomaximomogi
- Posts: 2
- Joined: Thu 18 Oct 2007 05:43
Doesn´t Work
Hi Plash, Thanks for the answer, but when I did that I got an "Access Violation Address". When I remove The AsOraClob and the changes the ftOraClob to ftString. Everything works fine! I´m using Oracle 10G Xe 10.2.0.1 and Delphi 7 with ODAC 5.10. Thanks
The TemporaryLobUpdate option was added in ODAC 6. For ODAC 5, try to use the following code:
TOraLob is declared in the OraClasses unit.
Code: Select all
var
Lob: TOraLob;
begin
Lob := vStored.ParamByName('P_SINOPSE').AsOraClob;
Lob.AsString := MemSinopse.Text;
Lob.OCISvcCtx := OraSession1.OCISvcCtx;
Lob.CreateTemporary(ltClob);
Lob.WriteLob;
vStored.Execute;
end;