Subject | Re: [ib-support] Re: Immediately get auto generated key |
---|---|
Author | Arno Brinkman |
Post date | 2003-02-09T14:32:27Z |
Hi,
CREATE PROCEDURE SP_INSERT_SESSION (SESSIONINFO VarChar(30)) returns
(SESSION_ID Integer) AS
DECLARE VARIABLE ID INTEGER;
BEGIN
ID = GEN_ID("GEN_SESSION_ID",1);
INSERT INTO
PLANSESSIONS (SESSION_ID, SESSION_INFO )
VALUES (:ID, :SESSIONINFO);
SESSION_ID = ID;
SUSPEND;
END
Regards,
Arno
> But I want to return the ID as output from stored procedure so that IUse it like this :
> can use it further in my program. How can I put the ID as output? Is
> the following correct?
>
> DECLARE VARIABLE ID INTEGER;
> BEGIN
> ID = GEN_ID("GEN_SESSION_ID",1);
> INSERT INTO
> PLANSESSIONS (SESSION_ID, SESSION_INFO )
> VALUES (:ID, :SESSIONINFO);
> INTO :SESSIONID
> SUSPEND;
> END
CREATE PROCEDURE SP_INSERT_SESSION (SESSIONINFO VarChar(30)) returns
(SESSION_ID Integer) AS
DECLARE VARIABLE ID INTEGER;
BEGIN
ID = GEN_ID("GEN_SESSION_ID",1);
INSERT INTO
PLANSESSIONS (SESSION_ID, SESSION_INFO )
VALUES (:ID, :SESSIONINFO);
SESSION_ID = ID;
SUSPEND;
END
Regards,
Arno