Subject | RE: [firebird-support] inteligent procedure for generators |
---|---|
Author | Alan McDonald |
Post date | 2004-04-16T05:41:33Z |
> Hi there!All you have to do is use a query
> I am new in the databse world.
> Usually i see in the documentation of interbase examples where a
> procedure getXXXCod call a one generator.
> How i can do if i want create a procedure that receive a parameter
> that will be passed to gen_id?
>
> some thing like this, i think:
>
> set term !! ;
> CREATE PROCEDURE getNextCode(genName char(20))
> returns result int;
> AS
> begin
> result= GEN_ID(genName, 1);
> exit;
> END;
> SET TERM ; !!
>
> So, i'm so sorry, because i tryed do that it didn't work.
>
> Help me please, because i am developing a software where a have
> about a hundred of generetors.
>
"SELECT GEN_ID(mygenname, 1) FROM RDB$DATABASE"
and you will get the value back - no need for a procedure
Alan