Subject | Re: [ib-support] Immediately get auto generated key |
---|---|
Author | Arno Brinkman |
Post date | 2003-02-09T14:01:59Z |
Hi,
INSERT.
DECLARE VARIABLE ID INTEGER;
BEGIN
ID = GEN_ID("GEN_SESSION_ID",1);
INSERT INTO
PLANSESSIONS (SESSION_ID, SESSION_INFO )
VALUES (:ID, :SESSIONINFO);
SUSPEND;
END
Regards,
Arno
> Is it possible in one Stored Procedure to get the auto generated keyI guess you use an generator in the trigger and check if SESSION_ID IS NULL.
> for a row?
> beginGenerate first the ID in the SP and use that as input value inside your
> INSERT INTO PLANSESSIONS ( SESSION_INFO )
> VALUES ( :SESSIONINFO );
> suspend;
> end
>
> But would like to get directly the autogenerated key 'SESSION_ID'.
> How can I do this?
INSERT.
DECLARE VARIABLE ID INTEGER;
BEGIN
ID = GEN_ID("GEN_SESSION_ID",1);
INSERT INTO
PLANSESSIONS (SESSION_ID, SESSION_INFO )
VALUES (:ID, :SESSIONINFO);
SUSPEND;
END
Regards,
Arno