Oracle中的FireDac呼叫功能

时间:2019-07-20 07:34:57

标签: oracle delphi firedac

我的代码:

FDStoredProc1.StoredProcName := 'aaaaa' ;
with FDStoredProc1.Params do begin
  Clear;
  with Add do begin
    ParamType := ptInput;
    DataType := ftInteger;
  end;
end;  
FDStoredProc1.Params[0].Value := StrToint(edit1.Text) ;
edit1.Text := FDStoredProc1.ExecFunc() ;

我在Oracle中的代码:

create or replace FUNCTION AAAAA (pn number) RETURN VARCHAR2 AS 
BEGIN
  update dmnv set thuong = pn  ; 
  commit  ; 
  RETURN '3' 
END AAAAA;

运行时没有错误,但是在Oracle Server(版本12)上,参数为NULL。因此,函数是服务器上的exec带有错误的参数(真正的参数是edit1.text中的值)。我在edit1上键入了一个数字。

2 个答案:

答案 0 :(得分:0)

为参数命名。

  with Add do begin
    Name := 'pn';
    ParamType := ptInput;
    DataType := ftInteger;
  end;

答案 1 :(得分:0)

with FDQuery1.SQL do begin
    Clear;
    Add('begin');
    Add('  select  aaaaa(8) from dual ;');
    Add('end;');
 end;
 FDQuery1.ExecSQL;

也收到错误。应该有一个INTO子句