Subject | Split range of numeric primary index? |
---|---|
Author | michael welsch |
Post date | 2003-11-28T08:17:30Z |
Hi,
are there any objectives against using two generators with different
start values for one index field in a table?
I give a simple Example to illustrate what I mean:
RECREATE TABLE ITEM
(
ID NUMERIC( 18, 0) NOT NULL,
LINKED_ITEM NUMERIC( 18, 0),
CONSTRAINT PK_ITEM PRIMARY KEY (ID)
CONSTRAINT FK_ITEM_ITEM FOREIGN KEY (LINKED_ITEM) REFERENCES ITEM
(ID) ON DELETE CASCADE ON UPDATE NO ACTION;
);
CREATE GENERATOR GEN_ID_LOW;
SET GENERATOR GEN_ID_LOW TO 0;
CREATE GENERATOR GEN_ID_HIGH;
SET GENERATOR GEN_ID_HIGH TO 999999999;
When inserting new elements I would then use different generators
depending on the originator of the data (i.e. vendor = GEN_ID_LOW or
cutomer = GEN_ID_HIGH).
In case of an update of the vendor originated data, it is then easy
to tell which data must be copied ( ID >999999999) to the new
database file to merge it with the new vendor data.
I appreciate any comment on this.
Thanks in advance
Michael
are there any objectives against using two generators with different
start values for one index field in a table?
I give a simple Example to illustrate what I mean:
RECREATE TABLE ITEM
(
ID NUMERIC( 18, 0) NOT NULL,
LINKED_ITEM NUMERIC( 18, 0),
CONSTRAINT PK_ITEM PRIMARY KEY (ID)
CONSTRAINT FK_ITEM_ITEM FOREIGN KEY (LINKED_ITEM) REFERENCES ITEM
(ID) ON DELETE CASCADE ON UPDATE NO ACTION;
);
CREATE GENERATOR GEN_ID_LOW;
SET GENERATOR GEN_ID_LOW TO 0;
CREATE GENERATOR GEN_ID_HIGH;
SET GENERATOR GEN_ID_HIGH TO 999999999;
When inserting new elements I would then use different generators
depending on the originator of the data (i.e. vendor = GEN_ID_LOW or
cutomer = GEN_ID_HIGH).
In case of an update of the vendor originated data, it is then easy
to tell which data must be copied ( ID >999999999) to the new
database file to merge it with the new vendor data.
I appreciate any comment on this.
Thanks in advance
Michael