Subject Re: [firebird-support] Cicling fields
Author Martijn Tonies
Hi,

> I have a table with 140 fieds.
> Named c1, c2.. c 140.
>
> c1..c140 are type integer
>
> Now I have to count some values into them.
>
> this is a code snippet:
> -- ******************************************
> cnt = 1; s0 = 0;
> while ( :cnt < 101 ) do begin
> if ( 'new.c' || :cnt = 0 ) then s0 = :s0 + 1;
> cnt = :cnt + 1;
> end
> -- ******************************************
>
> Firebird refuse this : 'new.c' || :cnt.

Refuses?

Well, 'new.c' is a character value, so this will result
in something like:

if ('new.c1' = 0)

Obviously, a string with that value never equals to the
numerical value 0.

> So don't works.
>
> Anyone could help??

You can only address columns (or the pseudo row in
a trigger with OLD/NEW.<columnname> ) by name.

That's not a string value that looks like a name.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com