Subject Re: Fill Fields
Author Adam
--- In firebird-support@yahoogroups.com, Arn <odth@...> wrote:
>
> Hi all
>
> I have a table with a lot of fields.
> They are namend from I1 ro I144
>
> I must fill them with various data, here is the snippet code I use.
>
> while( cont < 145 ) do begin
> 'I' || :cont = :n_starting;
> n_starting = :n_starting + :inc_n;
> cont = cont + 1;
> end
>
> Don't work.
> The problem is that I use 'I' || cont ..........
>
> Someone may help??

I would reconsider the design of that many fields. There is an upper
limit of fields you will need to be aware of. Not that I can recall it
off hand, you will need to look it up.

I would store these values in a separate table

Instead of

Foo:
ID,Name,I1,I2,I3,.....,I144

I would do something like

Foo:
ID,Name

Bar:
FooID,I,Value

Eg.

Foo
1, 'Hello', 100,200,300,.......,14400

Becomes

Foo:

1, 'Hello'

Bar

1,1,100
1,2,200
1,3,300
.
.
.
1,144,14400

Then you have a practical infinite capacity and your logic becomes
much easier (simple inserts).

If you want to persist with your current design, then the only way you
can do that is to use the EXECUTE STATEMENT command. Details are in
the release notes.

Adam