If the SELECT statement returns more than one row, you must use a cursor in a FETCH statement to fetch the rows individually. You can put the INTO clause in the FETCH statement rather than in the SELECT statement, but you should not put it in both.
The following ESQL/C code examples show different ways you can use the INTO clause. As both examples show, first you must use the DECLARE statement to declare a cursor.
EXEC SQL declare q_curs cursor for select lname, company into :p_lname, :p_company from customer; EXEC SQL open q_curs; while (SQLCODE == 0) EXEC SQL fetch q_curs; EXEC SQL close q_curs;
EXEC SQL declare q_curs cursor for select lname, company from customer; EXEC SQL open q_curs; while (SQLCODE == 0) EXEC SQL fetch q_curs into :p_lname, :p_company; EXEC SQL close q_curs;Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]