DECLARE count INTEGER; ... BEGIN count := count + 1; -- assigns a null to count
Therefore, never reference a variable before you assign it a value.
You can use assignment statements to assign values to a variable. For example, the following statement assigns a new value to the variable bonus, overwriting its old value:
bonus := salary * 0.15;
The expression following the assignment operator can be arbitrarily complex, but it must yield a datatype that is the same as or convertible to the datatype of the variable.
DECLARE done BOOLEAN;
the following statements are legal:
BEGIN done := FALSE; WHILE NOT done LOOP ...
When applied to an expression, the relational operators return a Boolean value. So, the following assignment is legal:
done := (count > 500);
SELECT ename, sal + comm INTO last_name, wages FROM emp WHERE empno = emp_id;
However, you cannot select column values into a Boolean variable.