Getting value from stored FB procedure

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
toneskok
Posts: 9
Joined: Tue 25 Sep 2012 11:14

Getting value from stored FB procedure

Post by toneskok » Tue 25 Sep 2012 11:21

Hi,

I have simple sp in FB that returns only one value. There is no suspend command in sp.
I'm using last version of Unidac controls.
Now I'm trying to get that returned value in Delphi app with TUniQuery.
In code I do:

Code: Select all

q.Clear;
q.SQL.Add('EXECUTE PROCEDURE TESTME(1)');
q.ExecSql;
Returned value is not in FieldByName collection, since this is execute statement, but it should be in ParamByName collection.

I also tried with

Code: Select all

q.Clear;
q.SQL.Add('EXECUTE PROCEDURE TESTME(1) RETURNING_VALUE :RET');
q.Prepare;
q.ExecSql;
But that also doesn't work.
I don't want to use TUniStoredProc component.

Any suggestions?

Regards, Tone

AndreyZ

Re: Getting value from stored FB procedure

Post by AndreyZ » Tue 25 Sep 2012 11:58

Hello,

You should use the following code:

Code: Select all

q.Clear;
q.CreateProcCall('TESTME');
q.ExecSql;
For more information about the CreateProcCall method, please refer to the UniDAC documentation.

toneskok
Posts: 9
Joined: Tue 25 Sep 2012 11:14

Re: Getting value from stored FB procedure

Post by toneskok » Tue 25 Sep 2012 12:14

That worked like charm.

Thank you.

Regards, Tone

AndreyZ

Re: Getting value from stored FB procedure

Post by AndreyZ » Tue 25 Sep 2012 12:18

If any other questions come up, please contact us.

Post Reply