SELECT statements that return a single row

You use the SELECT...INTO statement for queries that return a single record of data. For queries that return multiple rows (called a result set) you use an iterator object, as described in the next section, Result sets.

The SELECT...INTO statement includes a list of host variables in the INTO clause to which the selected data is assigned. For example:
#sql 
{ 
SELECT *  INTO :customer_num, :fname, :lname, :company,
:address1, :address2, :city, :state, :zipcode,
:phone              
FROM customer
WHERE customer_num = 101 
};

The number of selected expressions must match the number of host variables. The SQL types must be compatible with the host variable types. If you use online checking, the SQLJ translator checks that the order, number, and types of the SQL expressions and host variables match. For information on how to perform online checking, see Online checking.