How to execute Stored Procedure return its parameters/vars

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rfwoolf
Posts: 35
Joined: Thu 27 Aug 2009 19:39

How to execute Stored Procedure return its parameters/vars

Post by rfwoolf » Fri 28 Aug 2009 07:57

I use a TIBCQuery to execute a stored procedure using the SQL:
EXECUTE PROCEDURE "reserve_seat"(' +
FrmMainMenu.EdtStaffId.Text + ', ' + //StaffIDBooked
inttostr(Example) + ')';

I then call TIBCQuery.Open

Here I get an error message that this query returns no records.
So I have to change it to TIBCQuery.Execute.

I then try to access the return parameter 'Successful':
if aQuery1.fieldbyname('Successful').asstring = 'T' then...
and I get an error message that this field cannot be found.

Please help!!!! Also please note that this stored procedure has about 18 INPUT parameters, and about 3 output parameters.

===

UPDATE: Reading the forums it sounds like a possibility is to add the parameters to the query and upon execution your parameters get stored with the output parameters from the stored procedure.
Problem: How the hell do you add a parameter to these datasets programmatically??

rfwoolf
Posts: 35
Joined: Thu 27 Aug 2009 19:39

Post by rfwoolf » Fri 28 Aug 2009 09:32

Someone on Experts-Exchange suggested this solution which worked for me:
just treat the sp as a table, and do select f1, f2 from sp1 (param1, ...)

the SP must do a suspend statement
[/quote]

Post Reply