Subject Pls, help! What's wrong with this stored procedure?
Author Andrew Guts
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?

create table RepForms(
ID integer not null primary key,
Name varchar(80) not null,
CreateDate TIMESTAMP,
ModifyDate TIMESTAMP,
FormText BLOB SUB_TYPE 1
);

create generator G_RFORM_ID;
set generator G_RFORM_ID to 1;

set term ^ ;
create trigger On_Add_RForm for RepForms before insert as
begin
if (NEW.ID is NULL) THEN NEW.ID = GEN_ID(G_RFORM_ID, 1);
NEW.CREATEDATE = 'NOW';
end^
set term ; ^

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 ; ^

create index idx_RForm_Name on RepForms (Name);

Thanks ahead.

Andrew