Subject | Stored procedure to return primary key after insert |
---|---|
Author | killerion |
Post date | 2006-09-29T15:04:35Z |
I'm using a stored proc to insert into a table and return the
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...
James
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...
James