Subject Re: [firebird-support] Firebird Variable Declaration Problem
Author Alexandre Benson Smith
Are you declaring the variable inside an SP or EXECUTE BLOCK ?


set term ^;

create procedure SP_test returns(foo integer) as

declare variable bar integer;

begin
bar = 1;

while (bar < 10) do begin
foo = bar;
suspend;
bar = bar + 1;
end
end^

set term ;^

commit;

select * from sp_test;

or

set term ^;

execute block returns(foo integer) as

declare variable bar integer;

begin
bar = 1;

while (bar < 10) do begin
foo = bar;
suspend;
bar = bar + 1;
end
end^

set term ;^


see you !


Em 26/4/2011 11:43, Uwe escreveu:
> I have a very simple problem which I can't resolve.
>
> 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
>
>
> Total execution time: 0.009s
>
>
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org 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
>
>
>
>