getting a return parameter from an Orcale SP using Delphi

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
guest

getting a return parameter from an Orcale SP using Delphi

Post by guest » Tue 14 Dec 2004 11:41

Hi There,

I wonder if someonw could please help me with a problem that I am having calling an Oracle srtored procedure using ODAC in Delphi.

I am passing 22 parameters t a stored procedure, with the final paramater being an output paramater, which the stored procedure places a value into.

In Delphi I am using the follwoing code to retrieve the return value from the stored procedure :-

Form_RingDataSet.CurrentMeasring.DBAResult :=
OraStoredProc1.ParamByName('P_RETURN_RESULT').AsString;

However this causes an unknow error.

Could anyone plase point me in the right direction, or provide a code sample.

Thank you for your help.

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Tue 14 Dec 2004 16:31

We cannot reproduce you problem. What error message do you have? Please
check that OraStoredProc1.ParamByName('P_RETURN_RESULT').ParamType=ptOutput.
Please do the following.
Put a new TOraStoredProc component to the form. Double click on it and enter
stored procedure name in design-time dialog. Go to parameters page and check
that ParamType for 'P_RETURN_RESULT' is Output. Write the following code in
button click event


var
s: string;
begin
OraStoredProc1.ParamByName(...).AsString := ...;// AsString for string
parameters
...
OraStoredProc1.ParamByName(...).AsString := ...;
OraStoredProc1.Execute
s :=OraStoredProc1.ParamByName('P_RETURN_RESULT').AsString;
end;

guest

Post by guest » Tue 14 Dec 2004 17:58

Ok Thanks will try that and see what I get.

In honesty the code is not mine it is a company that I am working with and they have there own error handler that says geberal database access error, so I will have get them to also display the actual error message return from Oracle /Delphi.

Thanks again

Post Reply