Subject Re: [firebird-support] Re: constant un trigger/procedure
Author Michael Ludwig
emb_blaster schrieb am 11.03.2010 um 13:25:09 (-0000):
[[firebird-support] Re: constant un trigger/procedure]

> --- In firebird-support@yahoogroups.com, "svanderclock"
> <svanderclock@...> wrote:

> > i don't like to see in trigger some code like
> > if xxx = 3 then ...
> > is it possible to declare global constant like
> >
> > Declare MyconstanteName INTEGER = 3;

> Not AFAIK, but you can declare yours constants like vars and after the
> begin put initiate all of them. Anything like this:
>
> Create Procedure Blablabla...
> Declare MyFakeConstantName1 INTEGER; -- Constant
> Declare MyFakeConstantName2 INTEGER; -- Constant
> ....
> begin
> --Constants Initialization
> MyFakeConstantName1 = 3;
> MyFakeConstantName2 = 33;
> MyFakeConstantName3 = 333;

Just stumbled upon this feature request and thought I'd bump it as I've
been wondering whether a similar facility existed. To sum it up, in
addition to the non-global solution presented by emb_blaster above, the
following four global solutions were proposed:

(1) generators which you never increment
(2) stored procedures returning a constant
(3) UDFs returning a constant (all by "unordained")
(4) regular tables for lookup (by Alan McDonald)

Still, I think constants as database objects would be very useful, so
I've left a comment and my vote here:

http://tracker.firebirdsql.org/browse/CORE-670

--
Michael Ludwig