Subject Re: Duplicate keys
Author Stephen Boyd
--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@m...>
wrote:
> if LDSI_STOP_ID is a generator value PK, how do you get multiple
> LDSI_STOP_IDs such that you can have sequential LDSI_STOP_ITEM
values which
> start from 1?
> Alan
>

In really brief psuedo-code it goes like this:

LDS_STOP_ID := GEN_ID(LDS_GEN, 1);
CreateStopRecord(LDS_STOP_ID);
LDSI_STOP_ID := LDS_STOP_ID;
LDSI_ITEM_NUMBER := 1;
while (there_are_more_item_records) do
begin
UpdateItemRecord(LDSI_STOP_ID, LDSI_ITEM_NUMBER);
LDSI_ITEM_NUMBER := LDSI_ITEM_NUMBER + 1;
end;

Where UpdateItemRecord calls the aforementioned snippet of stored
procedure to update / insert the item record.