This topic describes some concepts and rules that are common to
using SQL statements in a host language.
Write applications that use SQL
You can create database applications in host languages that use DB2® UDB for iSeries™ SQL statements and functions.
Use host variables in SQL statements
When your program retrieves data, the values are put into data
items defined by your program and specified with the INTO clause of a SELECT
INTO or FETCH statement. The data items are called host variables.
Handle SQL error return codes using the SQLCA
When an SQL statement is processed in your program, SQL places a return code in the SQLCODE and SQLSTATE fields. The return codes indicate the success or failure of the running of your statement.
Use the SQL diagnostics area
The SQL diagnostics area is used to keep the returned information for an SQL statement that has been run in a program. It contains all the information that is available to you as an application programmer through the SQLCA.
Handle exception conditions with the WHENEVER Statement
The WHENEVER statement causes SQL to check the SQLSTATE and SQLCODE and continue processing your program, or branch to another area in your program if an error, exception, or warning exists as a result of running an SQL statement.