SQL Programming Manual for TAL
HP NonStop SQL Programming Manual for TAL—527887-001
B-1
B
Examples of Static NonStop SQL 
Programs
This appendix describes these sample static SQL programs:
•
Insertion program (TALTEST)
•
Date-time program (TALDT)
Insertion Program
The insertion program (TALTEST) uses the NonStop SQL sample database, which is 
described in Appendix A, Sample NonStop SQL Database
. TALTEST inserts a part 
name, part number, and quantity into the PARTS table and then inserts a new part into 
the PARTLOC table.
For database consistency, the program reads the SUPPLIER table to determine 
whether the supplier of the part is a record in the table. TALTEST reads the SUPPLIER 
table with a cursor, locking the row in the table. Then, it inserts a row in the PARTLOC 
and PARTS tables before committing the transaction.
TALTEST uses values that are supplied by initializing variables. It performs error 
processing using the SQLCODE value (and not the SQLCA structure).
TALTEST uses the =_DEFAULTS DEFINE for the default catalog in which the SQL 
compiler registers the program file and the TACL DEFINE names shown below for the 
table names.
SET DEFMODE ON
ALTER DEFINE =_DEFAULTS, CATALOG INVENT
SET DEFINE CLASS MAP
ADD DEFINE =PARTS, FILE SALES.PARTS
ADD DEFINE =SUPPLIER, FILE INVENT.SUPPLIER
ADD DEFINE =PARTLOC, FILE INVENT.PARTLOC
Figure B-1 shows the TALTEST program output. The object file name is TALTESTO.










