Variables and column names
If you use the same identifier for an SPL variable that you use for a column name, the database server assumes that each instance of the identifier is a variable. Qualify the column name with the table name, using dot notation, in order to use the identifier as a column name.
In the SELECT statement in the following figure, customer.lname is
a column name and lname is a variable name.
Figure 1. Column names and variable
names in a SELECT statement.
CREATE PROCEDURE table_test()
DEFINE lname CHAR(15);
LET lname = 'Miller';
SELECT customer.lname INTO lname FROM customer
WHERE customer_num = 502;
. . .
END PROCEDURE;