SQL Programming Manual for TAL
Examples of Dynamic NonStop SQL Programs
HP NonStop SQL Programming Manual for TAL—527887-001
C-10
Detailed Dynamic SQL Program
3. Prepares the SQL statement and assigns it a statement name (statement and
cursor host variables are not used).
4. Determines the data types of the:
•
Input parameters and moves them to the host variables of the corresponding
data types
•
Output variables and moves them to the host variables of the corresponding
data types
5. Sets up the SQLDA to point to the storage for the variables referenced by the
query. The storage is allocated at run time.
6. If there are parameters, uses the input SQLDA either to perform a cursor FETCH
for a SELECT statement or to execute a non-SELECT statement.
To run TALDYN, you must enter the TACL ADD DEFINE commands to associate the
ORDERS and ODETAIL tables with the =ORDERS and =ODETAIL DEFINE names:
SET DEFINE CLASS MAP
ADD DEFINE =ORDERS, FILE SALES.ORDERS
ADD DEFINE =ODETAIL, FILE SALES.ODETAIL
Figure C-2 shows the TALDYN output. The prompt is two greater than characters (>>).
The data entered by the user is shown in bold type. A semicolon is required to
terminate the input from the user. The query shown selects order numbers and
customer numbers from the ORDERS table, where the order includes part number
6400. The object file name is TALDYNO.