Subject Re: [firebird-support] Generator limits
Author Magni Thor Mortensen
Lucas Franzen wrote:
> Magni Thor Mortensen schrieb:
>
>> Martijn Tonies wrote:
>>
>>
>>>> Is there a limit on how many generators you can create ?
>>>>
>>>>
>>> There was a limit before, but in the later Firebird versions,
>>> there's no real limit.
>>>
>>> But what is your plan?
>>>
>>>
>> My plan is to create a generator for each row in a table by an after
>> insert trigger.
>>
>
> You cannot perform DDL in triggers / stored procedures.
> (well, you can by the means of using EXECUTEMENT STATEMENT but it's a
> bad idea).
> Maybe you should tell us what you like to have these generators for;
> sure there's a better way to achieve whatever you want.
>
> Luc.
>
Why is it a bad idea ?

I intend to use these generator to create transaction numbers for rows
in another table:
table_1
serie PK

Create trigger table_1_gen for table_1 after insert as begin
execute statement 'create generator g_' || new.serie;
end

table_2
serie PK (FK table 1)
tr PK

I must have a unique sequential tr number in table 2 and I thought it
best to use generators to prevent conflicts.
But I would appreciate any suggestions.

Thanks
Magni
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>