Subject | Re: [firebird-support] Stored procedure to return primary key after insert |
---|---|
Author | Martijn Tonies |
Post date | 2006-09-29T15:12:58Z |
> I'm using a stored proc to insert into a table and return theIn SQL statements, prefix variables and parameters with ":" ...
> generated primary key, but always says column not found, I doubt the
> problem is in the insert statement... here is a copy of the stored proc:
> CREATE PROCEDURE PRCDR_INSERT_MEMBER (
> CODE_MEM VARCHAR(15),
> FN VARCHAR(25),
> SN VARCHAR(10),
> FL VARCHAR(10),
> SLN VARCHAR(10))
> RETURNS (
> ID_MEM INTEGER)
> AS
> begin
> id_mem = gen_id( GEN_ID_MEMBER, 1 );
> CODE_MEM = CODE_MEM || id;
> INSERT INTO MEMBERS VALUES(id_mem, fn, sn, fln, sln);
> end^
>
> I've tried declaring a variable instead of using id_mem and assigning
> the variable to id_mem after the insert but same error...
> INSERT INTO MEMBERS VALUES(:id_mem, :fn, :sn, :fln, :sln);Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com