Changing Column Variable Names
Note that the &phone column variable illustrated in the previous section inherited its name from the phone column. This value is the default, but you can change it, as this example demonstrates:
begin-select
phone &cust_phone
if &cust_phone = ''
print 'No phone' (,1)
else
print &cust_phone (,1)
end-if
position (+1)
from customers
end-select
One reason for changing the name of the column variable is to use a selected column in an expression that has no name. For example:
begin-select
count(name) &cust_cnt (,1)
if &cust_cnt < 100
print 'Less than 100 customers'
end-if
position (+1)
from customers
group by city, state
end-select
In this example, the expression COUNT (name) is selected. In the program, you store this expression in the &cust_cnt column variable and refer to it afterwards by that name.