Inserting a single row by using a host variable
Use host variables in your INSERT statement when you don't know at least some of the values to insert until the program runs.
About this task
Restriction: These instructions apply only to
inserting a single row. If you want to insert multiple rows, use host
variable arrays or the form of the INSERT statement that selects values
from another table or view.
Procedure
To insert a single row by using host variables:
Specify an INSERT statement with column values in the VALUES
clause. Specify host variables or a combination of host variables
and constants as the column values.
Db2 inserts the first value into the first column in the list, the second value into the second column, and so on.
Example
EXEC SQL
INSERT INTO DSN8C10.ACT
VALUES (:HV-ACTNO, :HV-ACTKWD, :HV-ACTDESC)
END-EXEC.