Restrictions with the INTO Clause

If you execute a prepared SELECT statement that returns more than one row, or execute a prepared EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement for an SPL function that returns more than one group of return values, you receive an error message. In addition, if you prepare and declare a statement and then attempt to execute that statement, you receive an error message.

You cannot select a NULL value from a table column and place that value into an output variable. If you know in advance that a table column contains a NULL value, after you select the data, check the indicator variable that is associated with the column to determine if the value is NULL.

To use the INTO clause with the EXECUTE statement:

  1. Declare the output variables that the EXECUTE statement uses.
  2. Use PREPARE to prepare your SELECT statement or to prepare your EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement.
  3. Use the EXECUTE statement, with the INTO clause, to execute your SELECT statement or to execute your EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement.