Subject Re: [ib-support] Pls, help! What's wrong with this stored procedure?
Author Helen Borrie
At 01:39 PM 11-05-02 +0300, you wrote:
>Hi all. Could you please help me with this SP?
>
>There is a table, where some texts are stored. I wrote SP to add a new
>record there.
>Why doesn't it insert a row to the table, but returns generator's value?

If it returns the generator's value, and no error, then it performs the
INSERT. Why do you think the insert fails? Are you perhaps trying to
inspect the table before the EXECUTE PROCEDURE call is committed?

Helen

>set term ^ ;
>create procedure AddRepForm (NAME VARCHAR(80)) RETURNS (ID INTEGER)
>as
> DECLARE VARIABLE NewID integer;
>begin
> NewID = GEN_ID(G_RFORM_ID, 1);
> insert into RepForms (ID, Name) VALUES (:NewID, :Name);
> ID = NewID;
>end^
>set term ; ^

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________