Subject Re: [firebird-support] psql question about declare variable
Author Helen Borrie
At 09:51 PM 17/02/2005 +0000, you wrote:


>when creating a stored procedure why is it that sometimes you write
>
>AS
>DECLARE VAR1 INTEGER;
>BEGIN
>
>and other times you write it
>
>AS
>DECLARE VARIABLE VAR1 INTEGER;
>BEGIN

VARIABLE is an optional keyword when declaring variables. Currently you
don't declare other things in PSQL.

With Fb 2, you can declare a cursor. This doesn't affect the optionality of
DECLARE [VARIABLE]. Example from the release notes:

DECLARE RNAME CHAR(31);
DECLARE C CURSOR FOR ( SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS );
BEGIN
OPEN C;
WHILE (1 = 1) DO
BEGIN
FETCH C INTO :RNAME;
IF (ROW_COUNT = 0) THEN
LEAVE;
SUSPEND;
END
CLOSE C;
END

./hb