Subject Re: [IBO] TIBOQuery EditSQL with an anonymous sql block
Author Luis Solar
I've tried to call a stored procedure, but I have problems when I try to
return the table identifier, created under the stored procedure's context. I
need it at client side, because I have a grid that needs to refresh the
record with this new identifier.

I have the following code attached to TIBoQuery.EditSQL:

EXECUTE PROCEDURE ITEM_ORDER_UPDATE(
:ItemId, :ProductId, :Value, :OrderId
, :ItemId /* return a value */
)

And the stored procedure looks like this:

PROCEDURE ITEM_ORDER_UPDATE (
ItemId INTEGER,
ProductId INTEGER,
Value NUMERIC(10,2)
OrderID INTEGER
) RETURNS (
NewItemId INTEGER
) AS
IF (ItemId IS NULL) THEN
BEGIN
ItemId = GEN_ID(<sequence>, 1);
<INSERT CODE>;
END
ELSE
<UPDATE CODE>;
NewItemId = ItemId; /* RETURN PK */
SUSPEND;
END;

After the update, ibo returns the following error "parameter mismatch for
procedure ITEM_ORDER_UPDATE". ?.

Is there a better way to return the new created identifier?

Thanks for your support,
Luis Solar.


----- Original Message -----
From: Jason Wharton
To: IBObjects@yahoogroups.com
Sent: Thursday, October 23, 2003 5:16 PM
Subject: Re: [IBO] TIBOQuery EditSQL with an anonymous sql block


It is best to use a stored procedure, that way your execution takes place on
the server. It is also great because the stored procedure is pre-compiled
and thus ready to run more quickly and there isn't associated parsing going
on at the same time. Trust me, you want to use a stored procedure instead of
that. Also, its nice having your programming on the server instead of
embedded in the client app for maintenance purposes.

Jason

----- Original Message -----
From: "lsolart" <lsolar@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, October 23, 2003 12:53 PM
Subject: Re: [IBO] TIBOQuery EditSQL with an anonymous sql block


> So there is no way to create anonymous pl-sql block like oracle? (I
> used it frequently with ODAC/Oracle), or is it a design issue of
> fb/ib?
>
> Thanks again,
> Luis Solar.