Subject | RE: [ib-support] Determining generator's current value |
---|---|
Author | Rado Benc |
Post date | 2001-08-27T08:02:37Z |
Hi Don,
CREATE PROCEDURE GET_NEW_ACCOUNT_NO
RETURNS
(
AVALUE INTEGER
)
AS
BEGIN
AVALUE = GEN_ID(GEN_ACCOUNT_NO, 0);
END;
Note that GEN_ID(GEN_FOO, 0) does not increase the
value of GEN_FOO.
HTH,
Rado
> Using the standard trigger/generator method to create a unique primary keyIf I understand it correctly you need something like:
> value for a newly inserted record, is there a way to determine the primary
> key/generator value of the record I have just inserted? I want to
> insert the
> new record using a stored proc. and then use the primary key's value to do
> further processing within the same stored proc.
CREATE PROCEDURE GET_NEW_ACCOUNT_NO
RETURNS
(
AVALUE INTEGER
)
AS
BEGIN
AVALUE = GEN_ID(GEN_ACCOUNT_NO, 0);
END;
Note that GEN_ID(GEN_FOO, 0) does not increase the
value of GEN_FOO.
HTH,
Rado