Assignment Statement

From InterBase
Jump to: navigation, search

Go Up to Procedures and Triggers


Assigns a value to an input or output parameter or local variable. Available in triggers and stored procedures.

<variable> = <expression>;
Argument Description

<variable>

A local variable, input parameter, or output parameter.

<expression>

Any valid combination of variables, SQL operators, and expressions, including user-defined functions (UDFs) and generators.

Description: An assignment statement sets the value of a local variable, input parameter, or output parameter. Variables must be declared before they can be used in assignment statements.

Example: The first assignment statement below sets the value of x to 9. The second statement sets the value of y at twice the value of x. The third statement uses an arithmetic expression to assign z a value of 3.

DECLARE VARIABLE x INTEGER;
DECLARE VARIABLE y INTEGER;
DECLARE VARIABLE z INTEGER;
x = 9;
y = 2 * x;
z = 4 * x / (y - 6);

See Also