Subject Re: [firebird-support] Firebird Variable Declaration Problem
Author Paul Vinkenoog
Hello Uwe,

> How do you declare a variable in Firebird WI-V2.50.26074 Firebird 2.5 on Windows 7 64bit ?
>
> I try the following statement in Flamerobin
>
>
> DECLARE variable myvar integer;
>
>
> But whenever I try to run the statement I get the following result :
>
>
> Invalid token
>
> Engine Code : 335544569
> Engine Message :
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 1, column 9
> variable

You can only declare variables within PSQL code, that is: within a stored procedure, trigger, or executable block.

In DSQL, you can store and retrieve values with RDB$SET_CONTEXT() and RDB$GET_CONTEXT():
http://www.firebirdsql.org/refdocs/langrefupd21-intfunc-set_context.html


Hope this helps,
Paul Vinkenoog