Passing an TAdoDataset as parameter using TADOStoredProc
Posted
by Salvador
on Stack Overflow
See other posts from Stack Overflow
or by Salvador
Published on 2010-05-31T15:40:52Z
Indexed on
2010/05/31
15:43 UTC
Read the original article
Hit count: 374
i have an oracle stored procedure with 2 parameters declarated as input
cursors.
how i can assign this parameters the TADOStoredProc component?
ORACLE
PROCEDURE MYSTOREDPROCEDURE(P_HEADER IN TCursor, P_DETAL IN TCursor, P_RESULT OUT VARCHAR2)
BEGIN
//My code goes here
END;
Delphi
function TMyClass.Add(Header, Detail: TADODataSet;var _Result: string): boolean;
Var
StoredProc : TADOStoredProc;
begin
Result:=False;
StoredProc:=TADOStoredProc.Create(nil);
try
StoredProc.Connection :=ADOConnection1;
StoredProc.ProcedureName:='MYSTOREDPROCEDURE';
StoredProc.Parameters.Refresh;
StoredProc.Parameters.ParamByName('P_HEADER').Value :=Header;//How can assign this parameter?
try
StoredProc.Open;
_Result:=VarToStrNull(StoredProc.Parameters.ParamByName('P_RESULT').Value);
StoredProc.Close;
Result:=True;
except on E : Exception do
begin
_Result:=E.Message;
//exit;
end;
end;
finally
StoredProc.Free;
end;
end;
© Stack Overflow or respective owner