Page 1 of 1

getting a return parameter from an Orcale SP using Delphi

Posted: Tue 14 Dec 2004 11:41
by guest
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.

Posted: Tue 14 Dec 2004 16:31
by Paul
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;

Posted: Tue 14 Dec 2004 17:58
by guest
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