Subject RE: [IBO] RETURNING clause in Fb 2.1, how should it work?
Author Jason Wharton
Martijn,

> Hi Jason,
>
> I'm trying the following:
> INSERT INTO CUSTOMERS
> (
> COMPANY_NAME,
> CONTACT_FIRSTNAME,
> CONTACT_LASTNAME,
> CONTACT_MIDDLENAME
> )
> VALUES
> (
> '' /*COMPANY_NAME*/,
> '' /*CONTACT_FIRSTNAME*/,
> '' /*CONTACT_LASTNAME*/,
> '' /*CONTACT_MIDDLENAME*/
> )
> returning custid
>
> where CUSTID is being filled by a BEFORE INSERT trigger. When I run
> this statement (prepare, then run), IBO returns a "parameter"
> for "custid".

I'm guessing that you are using a TIBOQuery?
(Please remember to always specify which component.)

> Isn't it supposed to return a resultset with a single row?

Only if the statement prepared actually is a SELECT statement.

> For "statement type", IBO returns "ExecProcedure".

This most likely comes from the server as I read the statement type from
what the API returns.

You should notice that the parameter is of type ptOutput.

In native IBO you would get this in the Fields array instead of the Params
because I don't have the distinction of parameters for output.

Regards,
Jason Wharton