Subject Re: [ib-support] using Gen_id from a stored proc
Author Paul Reeves
Rhett Guthrie wrote:
>
> I am trying to write a simple stored proc that returns the results of
> running Gen_Id. I am trying to use this code:
>
> Create Procedure GeneratePrimaryKey
> Returns ("PK" Integer )
> As Begin
> "PK" = Gen_Id( PrimaryKeyGenerator, 1 );
> End !!
> Set Term ; !!
>
> I execute this code using both of these:
>
> Execute Procedure GeneratePrimaryKey
> Select PK From GeneratePrimaryKey
>
> However, though the PrimarykeyGenerator value is being incremented with
> both approaches, neither of these approaches are actually returning the
> generated value. I get back a table with one column and no data.
>

I took your code and executed it in ISQL. The Execute procedure statement works
fine. The Select statement doesn't because it needs a suspend. So, next
question, how and where are you testing this?

Paul
--

Paul Reeves
http://www.ibphoenix.com
taking InterBase further