Passing an TAdoDataset as parameter using TADOStoredProc
- by Salvador
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;