Subject Re: [IBO] Re: Return values from stored procedure
Author Lucas Franzen
sgharp schrieb:
> --- In IBObjects@yahoogroups.com, "constantijnw" <wolfs@x> wrote:
>
>>>When I do this I get an error "FieldName: pSuccess not found".
>
> The
>
>>>component must need the return parameter defined somewhere.
>>
>>Strange. I have one erratum:
>>
>>dsql.sql := ...
>>must be: dsql.sql.clear;
>> dsql.sql.add('......
>>
>>I've run a test which worked ok (without extra settings).
>>Are you sure 'psuccess' equals the name of the sp's outputpar?
>>How does the sp look like?
>
>
> I need to know how and where to specify the return parameter. This
> is what I have in the SQL property of the TIB_DSql component:
>
> execute procedure spGetLedgerID(:pVendorID, :pInvoiceNumber);
>
> I don't know where or how to define the return parameter. I've
> tried using key words like RETURNS or RETURNING_VALUES but they both
> barf.

They have to be part of the sp itself.

CREATE PROCEDURE SPGETLEDGER (
PVENDORID SOMETYPE,
PINVOICENUMBER SOMEOTHERTYPE
)
RETURNS (
SUCCESS SOMERETURNTYPE
[, or even more params]
)
AS
/* declare variable ... */
BEGIN
DO SOME OPERATIONS
SUCCESS = 'YEAH!'
END

This procedure will return a field (param) named SUCCESS.
Just Execute your DSQL and it will be there afterwards.

Luc.