Subject | RE: [ib-support] Re: more questions on use of generators |
---|---|
Author | Alan McDonald |
Post date | 2002-11-12T20:43:44Z |
You also do not need a table really
This procedure will do the same thing when you
SELECT NEXTJRECNO FROM GETNEXTJRECNO;
CREATE PROCEDURE GETNEXTJRECNO
RETURNS (
NEXTJRECNO INTEGER)
AS
BEGIN
NEXTJRECNO = GEN_ID(JRECNO_GEN, 1);
SUSPEND;
END
Alan
-----Original Message-----
From: Milan Babuskov [mailto:milanb@...]
Sent: Wednesday, 13 November 2002 1:10
To: ib-support@yahoogroups.com
Subject: [ib-support] Re: more questions on use of generators
create
it:
CREATE TABLE DUMMY (
FOOBAR INTEGER NOT NULL
);
ALTER TABLE DUMMY ADD check (foobar = 1);
ALTER TABLE DUMMY ADD PRIMARY KEY (FOOBAR);
GRANT SELECT ON DUMMY TO PUBLIC;
Later, I just do:
SELECT GEN_ID(GENERATOR_NAME, 1) FROM DUMMY;
You can also add a trigger to prevent users from deleting that single row
from DUMMY table.
Just my $0.02
Milan Babuskov
http://sourceforge.net/projects/fbexport
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
This procedure will do the same thing when you
SELECT NEXTJRECNO FROM GETNEXTJRECNO;
CREATE PROCEDURE GETNEXTJRECNO
RETURNS (
NEXTJRECNO INTEGER)
AS
BEGIN
NEXTJRECNO = GEN_ID(JRECNO_GEN, 1);
SUSPEND;
END
Alan
-----Original Message-----
From: Milan Babuskov [mailto:milanb@...]
Sent: Wednesday, 13 November 2002 1:10
To: ib-support@yahoogroups.com
Subject: [ib-support] Re: more questions on use of generators
> From: Helen Borrie <helebor@...>I have a table DUMMY in all my databases, I use the following DDL to
> Subject: Re: more questions on use of generators
>
> RDB$Database just happens to be "any old table that has one and only
> one row". You could create your own table to use instead, if you
> preferred, as long as you had some way (e.g. a trigger) to ensure
> that it would always have one and only one row.
>
> We all use RDB$Database because it's there. If it's InterBase you're
> using, not Firebird, be alerted that Borl have indicated that they
> might at some point prevent user queries on RDB$Database.
create
it:
CREATE TABLE DUMMY (
FOOBAR INTEGER NOT NULL
);
ALTER TABLE DUMMY ADD check (foobar = 1);
ALTER TABLE DUMMY ADD PRIMARY KEY (FOOBAR);
GRANT SELECT ON DUMMY TO PUBLIC;
Later, I just do:
SELECT GEN_ID(GENERATOR_NAME, 1) FROM DUMMY;
You can also add a trigger to prevent users from deleting that single row
from DUMMY table.
Just my $0.02
Milan Babuskov
http://sourceforge.net/projects/fbexport
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]