Skip to content

END-EXEC

EXEC SQL
SELECT *
INTO :variable
FROM table_name
END-EXEC;

Assuming the output of the query was stored in a variable called ‘variable’, the output should be the values from the selected column of the table.

The END-EXEC statement is used to mark the end of an SQL statement within a host program. The above code simply retrieves data from a table. The keyword INTO leading with : is used to represent the host variable where the retrieved data is stored. The keyword FROM is indicating the table to extract data from.