Firebird Documentation IndexFirebird 1.5 Language Ref. UpdatePSQL statements → DECLARE [VARIABLE] with initialization
Firebird Home Firebird Home Prev: BREAKFirebird Documentation IndexUp: PSQL statementsNext: EXCEPTION

DECLARE [VARIABLE] with initialization

Available in: PSQL

Changed in: 1.5

Description: In Firebird 1.5 and above, a PSQL local variable can be initialized upon declaration. The VARIABLE keyword has become optional.

Syntax: 

DECLARE [VARIABLE] varname datatype [{= | DEFAULT} value];

Example: 

create procedure proccie (a int)
returns (b int)
as
  declare p int;
  declare q int = 8;
  declare r int default 9;
  declare variable s int;
  declare variable t int = 10;
  declare variable u int default 11;
begin
  <intelligent code here>
end
Prev: BREAKFirebird Documentation IndexUp: PSQL statementsNext: EXCEPTION
Firebird Documentation IndexFirebird 1.5 Language Ref. UpdatePSQL statements → DECLARE [VARIABLE] with initialization